summaryrefslogtreecommitdiff
path: root/src/map/npc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.cpp')
-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_();