PathFinder.h 661 B

12345678910111213141516171819202122232425
  1. #ifndef PATH_FINDER_H
  2. #define PATH_FINDER_H
  3. #include "Entity.h"
  4. #include "Map.h"
  5. #include "Position.h"
  6. #include "Vector.h"
  7. struct PathFinder final {
  8. struct Path final {
  9. // FOUND is 0 to allow interpreting the enum as bool
  10. enum Result { FOUND, OUT_OF_RANGE, NOT_FOUND };
  11. Result result;
  12. // contains the path if result equals FOUND
  13. Vector<Position> path;
  14. };
  15. // a path finder is bound to a map
  16. PathFinder(const Map& map);
  17. // search for a path in a radius between the positions for an entity
  18. Path find(const Position& from, const Position& to, const Entity& e,
  19. float range);
  20. };
  21. #endif