Fixed private instance memory leaks.

This commit is contained in:
2020-10-19 04:30:12 +02:00
parent 55be58cc24
commit e97b58ccaf
4 changed files with 27 additions and 14 deletions

View File

@@ -628,16 +628,7 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
}
// post-warp: check if the source instance has no more players in it and delete it if so
if (PLAYERID(fromInstance) == 0)
return; // don't clean up overworld/IZ chunks
std::vector<std::tuple<int, int, uint64_t>> sourceChunkCoords = ChunkManager::getChunksInMap(fromInstance);
for (std::tuple<int, int, uint64_t>& coords : sourceChunkCoords) {
Chunk* chunk = ChunkManager::chunks[coords];
if (chunk->players.size() > 0)
return; // there are still players inside
}
ChunkManager::destroyInstance(fromInstance);
ChunkManager::destroyInstanceIfEmpty(fromInstance);
}
/*