From 37cc89345844da00e6b29019c8875480a7143cef Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 25 Aug 2018 18:07:31 +0200 Subject: [PATCH 1/2] Fix small error --- include/navparser.hpp | 7 +++++-- src/navparser.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/navparser.hpp b/include/navparser.hpp index 8b96ab2a..e1e90a3c 100644 --- a/include/navparser.hpp +++ b/include/navparser.hpp @@ -25,7 +25,7 @@ bool Prepare(); void CreateMove(); void Draw(); -size_t FindInVector(size_t id); +int FindInVector(size_t id); class inactivityTracker { @@ -303,9 +303,12 @@ struct MAP : public micropather::Graph if (inactiveTracker.IsIgnored( std::pair{ area->m_id, i.area->m_id })) continue; + int id = FindInVector(i.area->m_id); + if (id == -1) + return; micropather::StateCost cost; cost.state = - static_cast(&areas.at(FindInVector(i.area->m_id))); + static_cast(&areas.at(id)); cost.cost = area->m_center.DistTo(i.area->m_center); adjacent->push_back(cost); } diff --git a/src/navparser.cpp b/src/navparser.cpp index ea4ec0e5..c3e30478 100644 --- a/src/navparser.cpp +++ b/src/navparser.cpp @@ -17,9 +17,9 @@ static std::unique_ptr TF2MAP; // Function to get place in Vector by connection ID // Todo: find an alternative for this, maybe a map for storing ptrs to the // std::vector? -size_t FindInVector(size_t id) +int FindInVector(size_t id) { - for (size_t i = 0; i < areas.size(); i++) + for (int i = 0; i < areas.size(); i++) { if (areas.at(i).m_id == id) return i; From c3e5215abaa8230c207fb7a43d31d3f27f8c44d8 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 25 Aug 2018 19:28:22 +0200 Subject: [PATCH 2/2] Oof i forgot to readd this --- include/navparser.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/navparser.hpp b/include/navparser.hpp index e1e90a3c..83228b8b 100644 --- a/include/navparser.hpp +++ b/include/navparser.hpp @@ -131,8 +131,8 @@ public: { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || - ent->m_iClassID() != CL_CLASS(CObjectSentrygun) /*|| - ent->m_iTeam() == LOCAL_E->m_iTeam()*/) + ent->m_iClassID() != CL_CLASS(CObjectSentrygun) || + ent->m_iTeam() == LOCAL_E->m_iTeam()) continue; Vector sentryloc = GetBuildingPosition(ent); sentries.push_back(sentryloc);