From a8ba9a0e2a778ffb36bb308b613923ffdad60f5b Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 27 Jun 2021 16:25:56 +0200 Subject: [PATCH] Cleanup unused tile positions from OffMeshConnectionsManager --- .../detournavigator/offmeshconnectionsmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/detournavigator/offmeshconnectionsmanager.cpp b/components/detournavigator/offmeshconnectionsmanager.cpp index bb2ed773a5..c483934fb4 100644 --- a/components/detournavigator/offmeshconnectionsmanager.cpp +++ b/components/detournavigator/offmeshconnectionsmanager.cpp @@ -50,6 +50,16 @@ namespace DetourNavigator removed.emplace(endTilePosition); }); + for (const TilePosition& tilePosition : removed) + { + const auto it = values->mByTilePosition.find(tilePosition); + if (it == values->mByTilePosition.end()) + continue; + it->second.erase(id); + if (it->second.empty()) + values->mByTilePosition.erase(it); + } + values->mById.erase(byId.first, byId.second); return removed;