Core/Misc: Remove unneeded ToCreature() casts

Remove some ToCreature() casts not needed anymore after 1ee90e1022 changes that moved IsPet(), IsTotem(), IsSummon(), IsGuardian(), IsHunterPet() and IsVehicle() from Creature to Unit

(cherry picked from commit ea4d9c0d9e3339c96b94f13bbbfc1318bb6b03f9)

Conflicts:
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/scripts/Spells/spell_pet.cpp
This commit is contained in:
jackpoz
2015-09-24 22:06:05 +02:00
committed by Carbenium
parent cacf184822
commit 4700b24263
5 changed files with 19 additions and 19 deletions
+9 -9
View File
@@ -2537,7 +2537,7 @@ float Unit::GetUnitDodgeChance() const
return GetFloatValue(PLAYER_DODGE_PERCENTAGE);
else
{
if (ToCreature()->IsTotem())
if (IsTotem())
return 0.0f;
else
{
@@ -2609,7 +2609,7 @@ float Unit::GetUnitBlockChance() const
}
else
{
if (ToCreature()->IsTotem())
if (IsTotem())
return 0.0f;
else
{
@@ -3268,7 +3268,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);
@@ -7874,7 +7874,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())
@@ -8193,7 +8193,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, effect, stack);
@@ -8282,7 +8282,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
@@ -10635,7 +10635,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
@@ -12657,7 +12657,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())
@@ -14241,7 +14241,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();
}
@@ -940,7 +940,7 @@ namespace Trinity
bool operator()(Unit* u)
{
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (u->GetTypeId() == TYPEID_UNIT && u->ToCreature()->IsTotem())
if (u->GetTypeId() == TYPEID_UNIT && u->IsTotem())
return false;
if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range))
+1 -1
View File
@@ -54,7 +54,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
if (_player->GetCritterGUID() == pet->GetGUID())
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->IsSummon())
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsSummon())
pet->ToTempSummon()->UnSummon();
}
}
+4 -4
View File
@@ -1429,7 +1429,7 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli
case TARGET_UNIT_PASSENGER_5:
case TARGET_UNIT_PASSENGER_6:
case TARGET_UNIT_PASSENGER_7:
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsVehicle())
target = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0);
break;
default:
@@ -2023,7 +2023,7 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
m_procEx |= PROC_EX_INTERNAL_TRIGGERED;
}
// Totem casts require spellfamilymask defined in spell_proc_event to proc
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsTotem() && m_caster->IsControlledByPlayer())
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsTotem() && m_caster->IsControlledByPlayer())
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
}
@@ -3590,7 +3590,7 @@ void Spell::finish(bool ok)
if (!ok)
return;
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSummon())
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsSummon())
{
// Unsummon statue
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
@@ -5437,7 +5437,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (Unit* target = m_targets.GetUnitTarget())
{
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
if (target->IsMounted())
+4 -4
View File
@@ -2799,7 +2799,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
if (m_originalCaster)
{
owner = m_originalCaster->ToPlayer();
if (!owner && m_originalCaster->ToCreature()->IsTotem())
if (!owner && m_originalCaster->IsTotem())
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
}
@@ -2856,7 +2856,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
if (m_caster->GetTypeId() == TYPEID_UNIT)
{
if (m_caster->ToCreature()->IsTotem())
if (m_caster->IsTotem())
pet->SetReactState(REACT_AGGRESSIVE);
else
pet->SetReactState(REACT_DEFENSIVE);
@@ -3593,7 +3593,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
case 52173: // Coyote Spirit Despawn
case 60243: // Blood Parrot Despawn
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->IsSummon())
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->IsSummon())
unitTarget->ToTempSummon()->UnSummon();
return;
case 52479: // Gift of the Harvester
@@ -3689,7 +3689,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
case 60123: // Lightwell
{
if (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->IsSummon())
if (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->IsSummon())
return;
uint32 spell_heal;