diff options
Diffstat (limited to 'game/network/routeWalker.cpp')
-rw-r--r-- | game/network/routeWalker.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/game/network/routeWalker.cpp b/game/network/routeWalker.cpp index 496f9f3..d669db2 100644 --- a/game/network/routeWalker.cpp +++ b/game/network/routeWalker.cpp @@ -4,6 +4,7 @@ #include <limits> #include <memory> #include <utility> +#include <vector> RouteWalker::RouteWalker() : solutionLength {std::numeric_limits<float>::max()} { } @@ -27,10 +28,10 @@ RouteWalker::findRouteTo(const Link::End & currentEnd, const NodePtr & dest, flo return; } visited.insert(¤tEnd); - for (const auto & nexts : currentEnd.nexts) { - const auto link = nexts.first.lock(); - currentSolution.push_back(link); - findRouteTo(link->ends[!nexts.second], dest, length + link->length); + for (const auto & next : currentEnd.nexts) { + const auto link = next.first.lock(); + currentSolution.emplace_back(next); + findRouteTo(link->ends[!next.second], dest, length + link->length); currentSolution.pop_back(); } visited.erase(¤tEnd); |