Skip to content

Commit

Permalink
[9649] Replace some unnecessary Player::GetCorpse() calls.
Browse files Browse the repository at this point in the history
Signed-off-by: hunuza <hunuza@gmail.com>
  • Loading branch information
hunuza committed Mar 31, 2010
1 parent 5f38a41 commit a7f642d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4166,8 +4166,7 @@ void Player::BuildPlayerRepop()
}

// create a corpse and place it at the player's location
CreateCorpse();
Corpse *corpse = GetCorpse();
Corpse *corpse = CreateCorpse();
if(!corpse)
{
sLog.outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
Expand Down Expand Up @@ -4293,7 +4292,7 @@ void Player::KillPlayer()
UpdateObjectVisibility();
}

void Player::CreateCorpse()
Corpse* Player::CreateCorpse()
{
// prevent existence 2 corpse for player
SpawnCorpseBones();
Expand All @@ -4306,7 +4305,7 @@ void Player::CreateCorpse()
if(!corpse->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_CORPSE), this))
{
delete corpse;
return;
return NULL;
}

_uf = GetUInt32Value(UNIT_FIELD_BYTES_0);
Expand Down Expand Up @@ -4362,6 +4361,7 @@ void Player::CreateCorpse()

// register for player, but not show
sObjectAccessor.AddCorpse(corpse);
return corpse;
}

void Player::SpawnCorpseBones()
Expand Down Expand Up @@ -13969,7 +13969,7 @@ void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject
Player *pGroupGuy = itr->getSource();

// 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);
}
}
Expand Down Expand Up @@ -19777,7 +19777,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
}

// 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
if(pVictim->GetTypeId()==TYPEID_UNIT)
Expand Down Expand Up @@ -19829,7 +19829,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
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
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ class MANGOS_DLL_SPEC Player : public Unit

Corpse *GetCorpse() const;
void SpawnCorpseBones();
void CreateCorpse();
Corpse* CreateCorpse();
void KillPlayer();
uint32 GetResurrectionSpellId();
void ResurrectPlayer(float restore_percent, bool applySickness = false);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9648"
#define REVISION_NR "9649"
#endif // __REVISION_NR_H__

0 comments on commit a7f642d

Please sign in to comment.