diff options
Diffstat (limited to 'DijkstraPathfinder.h')
-rw-r--r-- | DijkstraPathfinder.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/DijkstraPathfinder.h b/DijkstraPathfinder.h index af475dd..d02d9cb 100644 --- a/DijkstraPathfinder.h +++ b/DijkstraPathfinder.h @@ -1,9 +1,30 @@ #pragma once +#include <unordered_map> + #include "Pathfinder.h" class DijkstraPathfinder : public Pathfinder { using Pathfinder::Pathfinder; +public: + virtual void find_between(const XY &, const XY &); + virtual const Path & get_path(); + +protected: + virtual void clear(); + +private: + Path solution; + XY end; + + struct Node { + XY parent; + unsigned int cost = -1; + }; + Node & map_get(const XY &); + std::unordered_map<XY, Node> map; + + void explore(const XY &, unsigned int cost = 0); }; |