From 9cb761abbe0862ac9b2c0e1036f720faacce5f37 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Mon, 20 Aug 2018 15:18:55 +0200 Subject: [PATCH] Fix small issues --- src/navparser.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/navparser.cpp b/src/navparser.cpp index a1c433db..8c6c5fad 100644 --- a/src/navparser.cpp +++ b/src/navparser.cpp @@ -211,7 +211,7 @@ int findClosestNavSquare(Vector vec) // Make sure we're not stuck on the same area for too long if (std::count(findClosestNavSquare_localAreas.begin(), findClosestNavSquare_localAreas.end(), i) < 3) - overlapping.push_back({ i, &areas.at(i) }); + overlapping.emplace_back( i, &areas.at(i) ); } } @@ -267,7 +267,7 @@ std::vector findPath(Vector loc, Vector dest, int &id_loc, int &id_dest) int result = TF2MAP->pather->Solve(static_cast(&areas.at(id_loc)), static_cast(&areas.at(id_dest)), &pathNodes, &cost); - logging::Info(format(result).c_str()); + logging::Info(format("Pathing: Pather result: ", result).c_str()); // If no result found, return empty Vector if (result == micropather::MicroPather::NO_SOLUTION) return std::vector(0); @@ -321,7 +321,8 @@ bool NavTo(Vector dest, bool navToLocalCenter, bool persistent, } crumbs.clear(); crumbs = std::move(path); - if (!navToLocalCenter) + lastArea = crumbs.at(0); + if (!navToLocalCenter && crumbs.size() > 1) crumbs.erase(crumbs.begin()); ensureArrival = persistent; findClosestNavSquare_localAreas.clear(); @@ -489,4 +490,15 @@ CatCommand navpath("nav_path", "Debug nav path", [](const CCommand &args) { } }); +CatCommand navpathnolocal("nav_path_nolocal", "Debug nav path", [](const CCommand &args) { + if (NavTo(loc, false, true, 50 + priority)) + { + logging::Info("Pathing: Success! Walking to path..."); + } + else + { + logging::Info("Pathing: Failed!"); + } +}); + } // namespace nav