mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-13 11:34:07 -04:00
Core/Corpses: Fix a crash in ConvertCorpseForPlayer
This commit is contained in:
@@ -8612,10 +8612,6 @@ void Player::RemovedInsignia(Player* looterPlr)
|
||||
RepopAtGraveyard();
|
||||
}
|
||||
|
||||
Corpse *corpse = GetCorpse();
|
||||
if (!corpse)
|
||||
return;
|
||||
|
||||
// We have to convert player corpse to bones, not to be able to resurrect there
|
||||
// SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
|
||||
Corpse *bones = sObjectAccessor->ConvertCorpseForPlayer(GetGUID(), true);
|
||||
|
||||
@@ -261,21 +261,20 @@ void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid,
|
||||
}
|
||||
}
|
||||
|
||||
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
|
||||
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia /*=false*/)
|
||||
{
|
||||
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
|
||||
if (!corpse)
|
||||
{
|
||||
//in fact this function is called from several places
|
||||
//even when player doesn't have a corpse, not an error
|
||||
// TODO: really, now...
|
||||
//sLog->outError("Try remove corpse that not in map for GUID %ul", player_guid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sLog->outStaticDebug("Deleting Corpse and spawned bones.");
|
||||
|
||||
Map* map = corpse->GetMap();
|
||||
// Map can be NULL
|
||||
Map* map = corpse->FindMap();
|
||||
|
||||
// remove corpse from player_guid -> corpse map and from current map
|
||||
RemoveCorpse(corpse);
|
||||
@@ -296,7 +295,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
|
||||
bones = new Corpse;
|
||||
bones->Create(corpse->GetGUIDLow(), map);
|
||||
|
||||
for (uint8 i = 3; i < CORPSE_END; ++i) // don't overwrite guid and object type
|
||||
for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type
|
||||
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
|
||||
|
||||
bones->SetGrid(corpse->GetGrid());
|
||||
|
||||
Reference in New Issue
Block a user