From 8cf389aaf748c77aecda0b3a3773c45053b0f231 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 25 Oct 2024 13:02:38 +0200 Subject: implement all ALGA features --- DijkstraPathfinder.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'DijkstraPathfinder.cpp') diff --git a/DijkstraPathfinder.cpp b/DijkstraPathfinder.cpp index 8a8e8eb..d920fc9 100644 --- a/DijkstraPathfinder.cpp +++ b/DijkstraPathfinder.cpp @@ -1,4 +1,3 @@ -#include #include #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); } -- cgit v1.2.3