diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-13 20:42:40 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-13 20:42:50 +0000 |
commit | 49ff05eda05f4f06eda3b6a2a6b116005db42e57 (patch) | |
tree | 8848b18fe92ee26e0c6a40e61d3436c4c8d9979a /game/network/routeWalker.cpp | |
parent | Simplified TestLink extending LinkStraight (diff) | |
download | ilt-49ff05eda05f4f06eda3b6a2a6b116005db42e57.tar.bz2 ilt-49ff05eda05f4f06eda3b6a2a6b116005db42e57.tar.xz ilt-49ff05eda05f4f06eda3b6a2a6b116005db42e57.zip |
Route Walker returns Link::Nexts, not vector links
This makes more sense when you realise that the existing navigation
workings work on exactly the same type!
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); |