Fix viewableChunks memory leaks

This commit is contained in:
Gent S 2020-11-25 22:49:37 -05:00
parent a9a8d96321
commit e3568ea506
2 changed files with 2 additions and 0 deletions

View File

@ -84,6 +84,7 @@ void NPCManager::destroyNPC(int32_t id) {
Eggs.erase(id);
// finally, remove it from the map and free it
delete entity->viewableChunks;
NPCs.erase(id);
delete entity;
}

View File

@ -81,6 +81,7 @@ void PlayerManager::removePlayer(CNSocket* key) {
std::cout << getPlayerName(key->plr) << " has left!" << std::endl;
delete plr->viewableChunks;
key->plr = nullptr;
delete plr;
players.erase(key);