summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorFreeyorp <TheFreeYorp+git@gmail.com>2024-04-21 07:09:23 +0000
committerFreeyorp <TheFreeYorp+git@gmail.com>2024-04-21 07:09:23 +0000
commitf31f51ae0fa0ce8f34de747dec3ed57a3f5373cd (patch)
tree0368c8712e34aa25fafb31b5a3c3e5e6e1e737c9 /src/map
parentae2556ec8fcbfed9e18d275a578f4bc47d26f721 (diff)
downloadtmwa-f31f51ae0fa0ce8f34de747dec3ed57a3f5373cd.tar.gz
tmwa-f31f51ae0fa0ce8f34de747dec3ed57a3f5373cd.tar.bz2
tmwa-f31f51ae0fa0ce8f34de747dec3ed57a3f5373cd.tar.xz
tmwa-f31f51ae0fa0ce8f34de747dec3ed57a3f5373cd.zip
DB/npc_free_internal: Use ancient approach
C++11 was a really long time ago, huh?
Diffstat (limited to 'src/map')
-rw-r--r--src/map/npc.cpp15
1 files changed, 12 insertions, 3 deletions
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<npc_data> 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<NpcEvent> 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_();