diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-08-12 14:05:14 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2015-08-12 14:05:14 +0200 |
| commit | ea4d9c0d9e3339c96b94f13bbbfc1318bb6b03f9 (patch) | |
| tree | 5ba72c28e13e8196a11edd09427bb3e3d09ac28a /src/server/game/Entities/Unit | |
| parent | d243630acff017f5e50bf0c833a0bbac35ba6c5a (diff) | |
Core/Misc: Remove unneeded ToCreature() casts
Remove some ToCreature() casts not needed anymore after 1ee90e1022a235859316e55356ea8a3d2f456c9b changes that moved IsPet(), IsTotem(), IsSummon(), IsGuardian(), IsHunterPet() and IsVehicle() from Creature to Unit
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bec32e4c421..c29b14d9c13 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2705,7 +2705,7 @@ float Unit::GetUnitDodgeChance() const return GetFloatValue(PLAYER_DODGE_PERCENTAGE); else { - if (ToCreature()->IsTotem()) + if (IsTotem()) return 0.0f; else { @@ -2780,7 +2780,7 @@ float Unit::GetUnitBlockChance() const } else { - if (ToCreature()->IsTotem()) + if (IsTotem()) return 0.0f; else { @@ -3485,7 +3485,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo ASSERT(!aurApp->GetEffectMask()); // Remove totem at next update if totem loses its aura - if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) + if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && IsTotem()) { if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE) ToTotem()->setDeathState(JUST_DIED); @@ -9473,7 +9473,7 @@ void Unit::GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry) Unit* unit = *itr; ++itr; if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT - && unit->ToCreature()->IsSummon()) // minion, actually + && unit->IsSummon()) // minion, actually Minions.push_back(unit->ToCreature()); } } @@ -9485,7 +9485,7 @@ void Unit::RemoveAllMinionsByEntry(uint32 entry) Unit* unit = *itr; ++itr; if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT - && unit->ToCreature()->IsSummon()) // minion, actually + && unit->IsSummon()) // minion, actually unit->ToTempSummon()->UnSummon(); // i think this is safe because i have never heard that a despawned minion will trigger a same minion } @@ -9585,7 +9585,7 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth) Unit* unit = this; - if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) + if (GetTypeId() == TYPEID_UNIT && IsTotem()) unit = GetOwner(); if (Player* player = unit->ToPlayer()) @@ -9876,7 +9876,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin return pdamage; // For totems get damage bonus from owner - if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) + if (GetTypeId() == TYPEID_UNIT && IsTotem()) if (Unit* owner = GetOwner()) return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype); @@ -10007,7 +10007,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage return 1.0f; // For totems pct done mods are calculated when its calculation is run on the player in SpellDamageBonusDone. - if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) + if (GetTypeId() == TYPEID_UNIT && IsTotem()) return 1.0f; // Done total percent damage auras @@ -12570,7 +12570,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const return false; // totems can not have threat list - if (ToCreature()->IsTotem()) + if (IsTotem()) return false; // vehicles can not have threat list @@ -14518,7 +14518,7 @@ Player* Unit::GetSpellModOwner() const if (Player* player = const_cast<Unit*>(this)->ToPlayer()) return player; - if (IsPet() || ToCreature()->IsTotem()) + if (IsPet() || IsTotem()) { if (Unit* owner = GetOwner()) if (Player* player = owner->ToPlayer()) @@ -16057,7 +16057,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) // a guardian should always have charminfo if (playerCharmer && this != charmer->GetFirstControlled()) playerCharmer->SendRemoveControlBar(); - else if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian())) + else if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !IsGuardian())) DeleteCharmInfo(); } |
