From f31f51ae0fa0ce8f34de747dec3ed57a3f5373cd Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Sun, 21 Apr 2024 07:09:23 +0000 Subject: DB/npc_free_internal: Use ancient approach C++11 was a really long time ago, huh? --- src/map/npc.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 76f0e14..e8d6d4b 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1053,9 +1053,18 @@ void npc_free_internal(dumb_ptr nd_) // Also clean up any events we registered to the global ev_db if (auto nd = nd_->is_script()) { - ev_db.erase_if([&](auto& pair) { - return pair.second.nd == nd; - }); + std::vector to_erase; + for (auto& pair : ev_db) + { + if (pair.second.nd == nd) + { + to_erase.push_back(pair.first); + } + } + for (auto& key : to_erase) + { + ev_db.erase(key); + } } nd_.delete_(); -- cgit v1.2.3-70-g09d2