Fix encounters leaking?

I didn't actually test this ...
This commit is contained in:
Michael Cook (mackal) 2017-03-18 01:30:59 -04:00
parent 11e227756d
commit bafb199d24
2 changed files with 14 additions and 1 deletions

View File

@ -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();
}

View File

@ -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);