[9649] Replace some unnecessary Player::GetCorpse() calls.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-03-31 09:28:51 +02:00
parent 41aee85145
commit 8b87c7ec97
3 changed files with 9 additions and 9 deletions

View file

@ -4166,8 +4166,7 @@ void Player::BuildPlayerRepop()
} }
// create a corpse and place it at the player's location // create a corpse and place it at the player's location
CreateCorpse(); Corpse *corpse = CreateCorpse();
Corpse *corpse = GetCorpse();
if(!corpse) if(!corpse)
{ {
sLog.outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow()); sLog.outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
@ -4293,7 +4292,7 @@ void Player::KillPlayer()
UpdateObjectVisibility(); UpdateObjectVisibility();
} }
void Player::CreateCorpse() Corpse* Player::CreateCorpse()
{ {
// prevent existence 2 corpse for player // prevent existence 2 corpse for player
SpawnCorpseBones(); SpawnCorpseBones();
@ -4306,7 +4305,7 @@ void Player::CreateCorpse()
if(!corpse->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_CORPSE), this)) if(!corpse->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_CORPSE), this))
{ {
delete corpse; delete corpse;
return; return NULL;
} }
_uf = GetUInt32Value(UNIT_FIELD_BYTES_0); _uf = GetUInt32Value(UNIT_FIELD_BYTES_0);
@ -4362,6 +4361,7 @@ void Player::CreateCorpse()
// register for player, but not show // register for player, but not show
sObjectAccessor.AddCorpse(corpse); sObjectAccessor.AddCorpse(corpse);
return corpse;
} }
void Player::SpawnCorpseBones() void Player::SpawnCorpseBones()
@ -13969,7 +13969,7 @@ void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject
Player *pGroupGuy = itr->getSource(); Player *pGroupGuy = itr->getSource();
// for any leave or dead (with not released body) group member at appropriate distance // for any leave or dead (with not released body) group member at appropriate distance
if( pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(pEventObject) && !pGroupGuy->GetCorpse() ) if( pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(pEventObject) && !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) )
pGroupGuy->AreaExploredOrEventHappens(questId); pGroupGuy->AreaExploredOrEventHappens(questId);
} }
} }
@ -19777,7 +19777,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
} }
// quest objectives updated only for alive group member or dead but with not released body // quest objectives updated only for alive group member or dead but with not released body
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse()) if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{ {
// normal creature (not pet/etc) can be only in !PvP case // normal creature (not pet/etc) can be only in !PvP case
if(pVictim->GetTypeId()==TYPEID_UNIT) if(pVictim->GetTypeId()==TYPEID_UNIT)
@ -19829,7 +19829,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
continue; // member (alive or dead) or his corpse at req. distance continue; // member (alive or dead) or his corpse at req. distance
// quest objectives updated only for alive group member or dead but with not released body // quest objectives updated only for alive group member or dead but with not released body
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse()) if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid); pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
} }
} }

View file

@ -1810,7 +1810,7 @@ class MANGOS_DLL_SPEC Player : public Unit
Corpse *GetCorpse() const; Corpse *GetCorpse() const;
void SpawnCorpseBones(); void SpawnCorpseBones();
void CreateCorpse(); Corpse* CreateCorpse();
void KillPlayer(); void KillPlayer();
uint32 GetResurrectionSpellId(); uint32 GetResurrectionSpellId();
void ResurrectPlayer(float restore_percent, bool applySickness = false); void ResurrectPlayer(float restore_percent, bool applySickness = false);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9648" #define REVISION_NR "9649"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__