From 200b23d13903e2a5aef22c85a99a901fbea5b264 Mon Sep 17 00:00:00 2001 From: LightCat Date: Tue, 16 Apr 2019 17:08:02 +0200 Subject: [PATCH] Fix a bug without navmeshes --- src/hacks/outofbounds.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/hacks/outofbounds.cpp b/src/hacks/outofbounds.cpp index 5f4a0b01..81428fc2 100644 --- a/src/hacks/outofbounds.cpp +++ b/src/hacks/outofbounds.cpp @@ -28,15 +28,20 @@ TextFile clip_file; static std::vector oob_list; static std::vector throughwall_list; -Posinfo AutoOOB() +Posinfo AutoOOB(bool oob) { std::string lvlname = g_IEngine->GetLevelName(); std::vector potential_spots{}; - for (auto &i : oob_list) - { - if (lvlname.find(i.lvlname) != lvlname.npos) - potential_spots.push_back(i.spot); - } + if (oob) + for (auto &i : oob_list) + { + if (lvlname.find(i.lvlname) != lvlname.npos) + potential_spots.push_back(i.spot); + } + else + for (auto &i : throughwall_list) + if (lvlname.find(i.lvlname) != lvlname.npos) + potential_spots.push_back(i.spot); Posinfo best_spot{}; float best_score = FLT_MAX; for (auto &i : potential_spots) @@ -143,7 +148,7 @@ void OutOfBounds_func(const CCommand &args, bool oob) } else { - auto loc = AutoOOB(); + auto loc = AutoOOB(oob); if (!loc.active) logging::Info("No valid spots found nearby!"); else