mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/Grids): Fix corpse loading after a server restart (#22594)
This commit is contained in:
@@ -1033,7 +1033,7 @@ void Map::UnloadAll()
|
||||
|
||||
_transports.clear();
|
||||
|
||||
for (auto& cellCorpsePair : _corpsesByCell)
|
||||
for (auto& cellCorpsePair : _corpsesByGrid)
|
||||
{
|
||||
for (Corpse* corpse : cellCorpsePair.second)
|
||||
{
|
||||
@@ -1043,7 +1043,7 @@ void Map::UnloadAll()
|
||||
}
|
||||
}
|
||||
|
||||
_corpsesByCell.clear();
|
||||
_corpsesByGrid.clear();
|
||||
_corpsesByPlayer.clear();
|
||||
_corpseBones.clear();
|
||||
}
|
||||
@@ -1848,6 +1848,12 @@ void Map::AddToActive(GameObject* d)
|
||||
AddToActiveHelper(d);
|
||||
}
|
||||
|
||||
template<>
|
||||
void Map::AddToActive(Corpse* /*c*/)
|
||||
{
|
||||
// do nothing for corpses
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Map::RemoveFromActive(T* obj)
|
||||
{
|
||||
@@ -2667,7 +2673,8 @@ void Map::AddCorpse(Corpse* corpse)
|
||||
{
|
||||
corpse->SetMap(this);
|
||||
|
||||
_corpsesByCell[corpse->GetCellCoord().GetId()].insert(corpse);
|
||||
GridCoord const gridCoord = Acore::ComputeGridCoord(corpse->GetPositionX(), corpse->GetPositionY());
|
||||
_corpsesByGrid[gridCoord.GetId()].insert(corpse);
|
||||
if (corpse->GetType() != CORPSE_BONES)
|
||||
_corpsesByPlayer[corpse->GetOwnerGUID()] = corpse;
|
||||
else
|
||||
@@ -2677,6 +2684,7 @@ void Map::AddCorpse(Corpse* corpse)
|
||||
void Map::RemoveCorpse(Corpse* corpse)
|
||||
{
|
||||
ASSERT(corpse);
|
||||
GridCoord const gridCoord = Acore::ComputeGridCoord(corpse->GetPositionX(), corpse->GetPositionY());
|
||||
|
||||
corpse->DestroyForNearbyPlayers();
|
||||
if (corpse->IsInGrid())
|
||||
@@ -2687,7 +2695,7 @@ void Map::RemoveCorpse(Corpse* corpse)
|
||||
corpse->ResetMap();
|
||||
}
|
||||
|
||||
_corpsesByCell[corpse->GetCellCoord().GetId()].erase(corpse);
|
||||
_corpsesByGrid[gridCoord.GetId()].erase(corpse);
|
||||
if (corpse->GetType() != CORPSE_BONES)
|
||||
_corpsesByPlayer.erase(corpse->GetOwnerGUID());
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user