Core/Corpses: Fixed map crash happening during map unload when there are corpses inside

This commit is contained in:
Shauren committed 2015-10-29 18:46:37 +01:00
1 parent 7dcddd90be
commit 1d17475791
3 files changed
+10 -3

No files matched your search

+8 -1
View File
@@ -1603,11 +1603,18 @@ void Map::UnloadAll()
}
for (auto& cellCorpsePair : _corpsesByCell)
{
for (Corpse* corpse : cellCorpsePair.second)
{
corpse->RemoveFromWorld();
corpse->ResetMap();
delete corpse;
}
}
_corpsesByCell.clear();
_corpsesByPlayer.clear();
_corpseBones.clear();
}
// *****************************
@@ -3632,7 +3639,7 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*=
{
// Create bones, don't change Corpse
bones = new Corpse();
bones->Create(corpse->GetGUID().GetCounter(), this);
bones->Create(corpse->GetGUID().GetCounter());
for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));