mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Few small optimizations here and there
This commit is contained in:
@@ -881,10 +881,15 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
|
||||
{
|
||||
sScriptMgr->OnPlayerLeaveMap(this, player);
|
||||
|
||||
player->getHostileRefManager().deleteReferences(); // multithreading crashfix
|
||||
|
||||
bool const inWorld = player->IsInWorld();
|
||||
player->RemoveFromWorld();
|
||||
SendRemoveTransports(player);
|
||||
|
||||
player->UpdateObjectVisibility(true);
|
||||
if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
|
||||
player->DestroyForNearbyPlayers(); // previous player->UpdateObjectVisibility(true)
|
||||
|
||||
if (player->IsInGrid())
|
||||
player->RemoveFromGrid();
|
||||
else
|
||||
@@ -897,11 +902,15 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
|
||||
template<class T>
|
||||
void Map::RemoveFromMap(T *obj, bool remove)
|
||||
{
|
||||
bool const inWorld = obj->IsInWorld() && obj->GetTypeId() >= TYPEID_UNIT && obj->GetTypeId() <= TYPEID_GAMEOBJECT;
|
||||
obj->RemoveFromWorld();
|
||||
|
||||
if (obj->isActiveObject())
|
||||
RemoveFromActive(obj);
|
||||
|
||||
obj->UpdateObjectVisibility(true);
|
||||
if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
|
||||
obj->DestroyForNearbyPlayers(); // previous obj->UpdateObjectVisibility(true)
|
||||
|
||||
obj->RemoveFromGrid();
|
||||
|
||||
obj->ResetMap();
|
||||
|
||||
Reference in New Issue
Block a user