diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-11-06 21:30:08 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-11-06 21:30:41 +0100 |
commit | 910fb001305bbe2fd3ad198840a5e26d9d2481c3 (patch) | |
tree | 45d0be1aa7dddbe8805da42545452ba8ee5a3d2b | |
parent | a08611dfefc60d9092b7c36c7553a41ed04be187 (diff) |
Core/Corpses: Fixed a possible crash adding bones to grid
Closes #15808
(cherry picked from commit ec1583df67605b7253a34dc5f153cdad5b16969e)
-rw-r--r-- | src/server/game/Maps/Map.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 4893b742a16..db74e71e867 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -303,19 +303,19 @@ template<> void Map::AddToGrid(Corpse* obj, Cell const& cell) { NGridType* grid = getNGrid(cell.GridX(), cell.GridY()); - if (obj->IsWorldObject()) - { - // Corpses are a special object type - they can be added to grid via a call to AddToMap - // or loaded through ObjectGridLoader. - // Both corpses loaded from database and these freshly generated by Player::CreateCoprse are added to _corpsesByCell - // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded - // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader) - // to avoid failing an assertion in GridObject::AddToGrid - if (grid->isGridObjectDataLoaded()) + // Corpses are a special object type - they can be added to grid via a call to AddToMap + // or loaded through ObjectGridLoader. + // Both corpses loaded from database and these freshly generated by Player::CreateCoprse are added to _corpsesByCell + // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded + // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader) + // to avoid failing an assertion in GridObject::AddToGrid + if (grid->isGridObjectDataLoaded()) + { + if (obj->IsWorldObject()) grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj); + else + grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj); } - else - grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj); // bones. nothing special here } template<class T> |