Core: Codestyle clean-up

"plr"->player

Note: codestyle methods needs maintained, Player* player.
This commit is contained in:
Bootz
2011-11-07 11:06:39 -06:00
parent c51f6e7fa0
commit f75ec5ba2b
67 changed files with 852 additions and 852 deletions
+10 -10
View File
@@ -2723,19 +2723,19 @@ void WorldObject::DestroyForNearbyPlayers()
VisitNearbyWorldObject(GetVisibilityRange(), searcher);
for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
Player* plr = (*iter);
Player* player = (*iter);
if (plr == this)
if (player == this)
continue;
if (!plr->HaveAtClient(this))
if (!player->HaveAtClient(this))
continue;
if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == plr->GetGUID()) // TODO: this is for puppet
if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == player->GetGUID()) // TODO: this is for puppet
continue;
DestroyForPlayer(plr);
plr->m_clientGUIDs.erase(GetGUID());
DestroyForPlayer(player);
player->m_clientGUIDs.erase(GetGUID());
}
}
@@ -2803,13 +2803,13 @@ struct WorldObjectChangeAccumulator
}
}
void BuildPacket(Player* plr)
void BuildPacket(Player* player)
{
// Only send update once to a player
if (plr_list.find(plr->GetGUID()) == plr_list.end() && plr->HaveAtClient(&i_object))
if (plr_list.find(player->GetGUID()) == plr_list.end() && player->HaveAtClient(&i_object))
{
i_object.BuildFieldsUpdate(plr, i_updateDatas);
plr_list.insert(plr->GetGUID());
i_object.BuildFieldsUpdate(player, i_updateDatas);
plr_list.insert(player->GetGUID());
}
}
@@ -114,9 +114,9 @@ void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note)
m_playerSocialMap[friend_guid].Note = note;
}
void PlayerSocial::SendSocialList(Player* plr)
void PlayerSocial::SendSocialList(Player* player)
{
if (!plr)
if (!player)
return;
uint32 size = m_playerSocialMap.size();
@@ -127,7 +127,7 @@ void PlayerSocial::SendSocialList(Player* plr)
for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
{
sSocialMgr->GetFriendInfo(plr, itr->first, itr->second);
sSocialMgr->GetFriendInfo(player, itr->first, itr->second);
data << uint64(itr->first); // player guid
data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?)
@@ -144,7 +144,7 @@ void PlayerSocial::SendSocialList(Player* plr)
}
}
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST");
}
+1 -1
View File
@@ -124,7 +124,7 @@ class PlayerSocial
void RemoveFromSocialList(uint32 friend_guid, bool ignore);
void SetFriendNote(uint32 friend_guid, std::string note);
// Packet send's
void SendSocialList(Player* plr);
void SendSocialList(Player* player);
// Misc
bool HasFriend(uint32 friend_guid);
bool HasIgnore(uint32 ignore_guid);
@@ -489,13 +489,13 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
{
Player* plr = *itr;
Player* player = *itr;
++itr;
if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
plr->ResurrectPlayer(1.0f);
if (player->isDead() && !player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
player->ResurrectPlayer(1.0f);
plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
player->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
}
//we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference...
+55 -55
View File
@@ -5765,11 +5765,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Ice Block
case 56372:
{
Player* plr = ToPlayer();
if (!plr)
Player* player = ToPlayer();
if (!player)
return false;
SpellCooldowns const cooldowns = plr->GetSpellCooldowns();
SpellCooldowns const cooldowns = player->GetSpellCooldowns();
// remove cooldowns on all ranks of Frost Nova
for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
{
@@ -5777,7 +5777,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Frost Nova
if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
&& cdSpell->SpellFamilyFlags[0] & 0x00000040)
plr->RemoveSpellCooldown(cdSpell->Id, true);
player->RemoveSpellCooldown(cdSpell->Id, true);
}
break;
}
@@ -7059,26 +7059,26 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
Player* plr = ToPlayer();
if (!plr || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
Player* player = ToPlayer();
if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
return false;
// custom cooldown processing case
if (cooldown && plr->HasSpellCooldown(dummySpell->Id))
if (cooldown && player->HasSpellCooldown(dummySpell->Id))
return false;
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
return false;
WeaponAttackType attType = WeaponAttackType(plr->GetAttackBySlot(castItem->GetSlot()));
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || !isAttackReady(attType))
return false;
// Now compute real proc chance...
uint32 chance = 20;
plr->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
player->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
Item* addWeapon = plr->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
Item* addWeapon = player->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
uint32 enchant_id_add = addWeapon ? addWeapon->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)) : 0;
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id_add);
if (pEnchant && pEnchant->spellid[0] == dummySpell->Id)
@@ -7123,7 +7123,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// apply cooldown before cast to prevent processing itself
if (cooldown)
plr->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
player->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
// Attack Twice
for (uint32 i = 0; i < 2; ++i)
@@ -8074,9 +8074,9 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
*handled = true;
// Convert recently used Blood Rune to Death Rune
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
if (plr->getClass() != CLASS_DEATH_KNIGHT)
if (player->getClass() != CLASS_DEATH_KNIGHT)
return false;
RuneType rune = ToPlayer()->GetLastUsedRune();
@@ -8100,22 +8100,22 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
if (dummySpell->SpellIconID == 2622)
{
if (plr->GetCurrentRune(i) == RUNE_DEATH ||
plr->GetBaseRune(i) == RUNE_BLOOD)
if (player->GetCurrentRune(i) == RUNE_DEATH ||
player->GetBaseRune(i) == RUNE_BLOOD)
continue;
}
else
{
if (plr->GetCurrentRune(i) == RUNE_DEATH ||
plr->GetBaseRune(i) != RUNE_BLOOD)
if (player->GetCurrentRune(i) == RUNE_DEATH ||
player->GetBaseRune(i) != RUNE_BLOOD)
continue;
}
if (plr->GetRuneCooldown(i) != plr->GetRuneBaseCooldown(i))
if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i))
continue;
--runesLeft;
// Mark aura as used
plr->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
}
return true;
}
@@ -8791,11 +8791,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Blade Barrier
if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85)
{
Player* plr = ToPlayer();
if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT)
Player* player = ToPlayer();
if (!player || player->getClass() != CLASS_DEATH_KNIGHT)
return false;
if (!plr->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
if (!player->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
return false;
}
@@ -10144,20 +10144,20 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
// only called in Player::SetSeer
// so move it to Player?
void Unit::AddPlayerToVision(Player* plr)
void Unit::AddPlayerToVision(Player* player)
{
if (m_sharedVision.empty())
{
setActive(true);
SetWorldObject(true);
}
m_sharedVision.push_back(plr);
m_sharedVision.push_back(player);
}
// only called in Player::SetSeer
void Unit::RemovePlayerFromVision(Player* plr)
void Unit::RemovePlayerFromVision(Player* player)
{
m_sharedVision.remove(plr);
m_sharedVision.remove(player);
if (m_sharedVision.empty())
{
setActive(false);
@@ -11894,7 +11894,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
// mount as a vehicle
if (VehicleId)
@@ -11910,7 +11910,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
SendMessageToSet(&data, true);
data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
// mounts can also have accessories
GetVehicleKit()->InstallAllAccessories(false);
@@ -11918,7 +11918,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
}
// unsummon pet
Pet* pet = plr->GetPet();
Pet* pet = player->GetPet();
if (pet)
{
Battleground* bg = ToPlayer()->GetBattleground();
@@ -11926,7 +11926,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
if (bg && bg->isArena())
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
else
plr->UnsummonPetTemporaryIfAny();
player->UnsummonPetTemporaryIfAny();
}
}
@@ -11962,15 +11962,15 @@ void Unit::Unmount()
// only resummon old pet if the player is already added to a map
// this prevents adding a pet to a not created map which would otherwise cause a crash
// (it could probably happen when logging in after a previous crash)
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
if (Pet* pPet = plr->GetPet())
if (Pet* pPet = player->GetPet())
{
if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STAT_STUNNED))
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
else
plr->ResummonPetTemporaryUnSummonedIfAny();
player->ResummonPetTemporaryUnSummonedIfAny();
}
}
@@ -13556,10 +13556,10 @@ void Unit::SetHealth(uint32 val)
SetUInt32Value(UNIT_FIELD_HEALTH, val);
// group update
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
if (plr->GetGroup())
plr->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
if (player->GetGroup())
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
}
else if (Pet* pet = ToCreature()->ToPet())
{
@@ -14772,9 +14772,9 @@ void Unit::ClearComboPointHolders()
{
uint32 lowguid = *m_ComboPointHolders.begin();
Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
if (plr && plr->GetComboTarget() == GetGUID()) // recheck for safe
plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
else
m_ComboPointHolders.erase(lowguid); // or remove manually
}
@@ -15341,9 +15341,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
return;
// Inform pets (if any) when player kills target)
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
Pet* pet = plr->GetPet();
Pet* pet = player->GetPet();
if (pet && pet->isAlive() && pet->isControlled())
pet->AI()->KilledUnit(victim);
}
@@ -15915,10 +15915,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
}
else
{
Player* plr = ToPlayer();
if (plr->isAFK())
plr->ToggleAFK();
plr->SetClientControl(this, 0);
Player* player = ToPlayer();
if (player->isAFK())
player->ToggleAFK();
player->SetClientControl(this, 0);
}
// charm is set by aura, and aura effect remove handler was called during apply handler execution
@@ -16981,25 +16981,25 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
if (aurApp && aurApp->GetRemoveMode())
return;
if (Player* plr = ToPlayer())
if (Player* player = ToPlayer())
{
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && plr->isInCombat())
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->isInCombat())
return;
InterruptNonMeleeSpells(false);
plr->StopCastingCharm();
plr->StopCastingBindSight();
player->StopCastingCharm();
player->StopCastingBindSight();
Unmount();
RemoveAurasByType(SPELL_AURA_MOUNTED);
// drop flag at invisible in bg
if (Battleground* bg = plr->GetBattleground())
bg->EventPlayerDroppedFlag(plr);
if (Battleground* bg = player->GetBattleground())
bg->EventPlayerDroppedFlag(player);
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
plr->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
plr->UnsummonPetTemporaryIfAny();
player->UnsummonPetTemporaryIfAny();
}
ASSERT(!m_vehicle);
@@ -17073,8 +17073,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
SendMonsterMoveExitVehicle(&pos);
Relocate(&pos);
if (Player* plr = ToPlayer())
plr->ResummonPetTemporaryUnSummonedIfAny();
if (Player* player = ToPlayer())
player->ResummonPetTemporaryUnSummonedIfAny();
WorldPacket data2;
BuildHeartBeatMsg(&data2);
+2 -2
View File
@@ -1730,8 +1730,8 @@ class Unit : public WorldObject
//Player* GetMoverSource() const;
Player* m_movedPlayer;
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
void AddPlayerToVision(Player* plr);
void RemovePlayerFromVision(Player* plr);
void AddPlayerToVision(Player* player);
void RemovePlayerFromVision(Player* player);
bool HasSharedVision() const { return !m_sharedVision.empty(); }
void RemoveBindSightAuras();
void RemoveCharmAuras();