|
@@ -0,0 +1,25 @@
|
|
|
+#ifndef PATH_FINDER_H
|
|
|
+#define PATH_FINDER_H
|
|
|
+
|
|
|
+#include "Entity.h"
|
|
|
+#include "Map.h"
|
|
|
+#include "Position.h"
|
|
|
+#include "Vector.h"
|
|
|
+
|
|
|
+struct PathFinder final {
|
|
|
+ struct Path final {
|
|
|
+ // FOUND is 0 to allow interpreting the enum as bool
|
|
|
+ enum Result { FOUND, OUT_OF_RANGE, NOT_FOUND };
|
|
|
+ Result result;
|
|
|
+ // contains the path if result equals FOUND
|
|
|
+ Vector<Position> path;
|
|
|
+ };
|
|
|
+
|
|
|
+ // a path finder is bound to a map
|
|
|
+ PathFinder(const Map& map);
|
|
|
+ // search for a path in a radius between the positions for an entity
|
|
|
+ Path find(const Position& from, const Position& to, const Entity& e,
|
|
|
+ float range);
|
|
|
+};
|
|
|
+
|
|
|
+#endif
|