fix(Core/Map): Fix zone player count update on player removal (#23211)

This commit is contained in:
Andrew
2025-10-13 09:56:17 -03:00
committed by GitHub
parent 8560c4825a
commit 9ff1d3f06a

View File

@@ -422,7 +422,9 @@ void Map::UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
else
--oldZoneCount;
}
++_zonePlayerCountMap[newZone];
if (newZone != MAP_INVALID_ZONE)
++_zonePlayerCountMap[newZone];
}
void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
@@ -696,8 +698,8 @@ struct ResetNotifier
void Map::RemovePlayerFromMap(Player* player, bool remove)
{
// Before leaving map, update zone/area for stats
player->UpdateZone(MAP_INVALID_ZONE, 0);
UpdatePlayerZoneStats(player->GetZoneId(), MAP_INVALID_ZONE);
player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix
player->RemoveFromWorld();