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
+13 -1
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();
}