diff options
Diffstat (limited to 'DijkstraPathfinder.cpp')
-rw-r--r-- | DijkstraPathfinder.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/DijkstraPathfinder.cpp b/DijkstraPathfinder.cpp index 8a8e8eb..d920fc9 100644 --- a/DijkstraPathfinder.cpp +++ b/DijkstraPathfinder.cpp @@ -1,4 +1,3 @@ -#include <algorithm> #include <queue> #include "DijkstraPathfinder.h" @@ -6,13 +5,8 @@ using namespace std; -const DijkstraPathfinder::Path & DijkstraPathfinder::get_path() { - return this->solution; -} - void DijkstraPathfinder::clear() { Pathfinder::clear(); - this->solution.clear(); this->map.clear(); } @@ -30,11 +24,13 @@ void DijkstraPathfinder::find_between(const XY & start, const XY & end) { XY pos = end; int steps = 0; + Path solution; while (pos != start) { solution.push_front(pos); pos = this->map_get(pos).parent; steps++; } + this->set_solved(solution); printf("Dijkstra: solution found (%d steps, %u time)\n", steps, this->map_get(end).distance); } |