diff --git a/zone/entity.cpp b/zone/entity.cpp index 4a6c2c20a..18d55d695 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2224,7 +2224,8 @@ void EntityList::RemoveAllObjects() } } -void EntityList::RemoveAllTraps(){ +void EntityList::RemoveAllTraps() +{ auto it = trap_list.begin(); while (it != trap_list.end()) { safe_delete(it->second); @@ -2233,6 +2234,16 @@ void EntityList::RemoveAllTraps(){ } } +void EntityList::RemoveAllEncounters() +{ + auto it = encounter_list.begin(); + while (it != encounter_list.end()) { + safe_delete(it->second); + free_ids.push(it->first); + it = encounter_list.erase(it); + } +} + bool EntityList::RemoveMob(uint16 delete_id) { if (delete_id == 0) @@ -2410,6 +2421,7 @@ void EntityList::Clear() entity_list.RemoveAllDoors(); entity_list.RemoveAllObjects(); entity_list.RemoveAllRaids(); + entity_list.RemoveAllEncounters(); entity_list.RemoveAllLocalities(); } diff --git a/zone/entity.h b/zone/entity.h index 1ea9a4c03..0ee029940 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -292,6 +292,7 @@ public: void RemoveAllObjects(); void RemoveAllLocalities(); void RemoveAllRaids(); + void RemoveAllEncounters(); void DestroyTempPets(Mob *owner); int16 CountTempPets(Mob *owner); void AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy = false);