fix(Core/Misc): Change const to be after type name (#10591)

This commit is contained in:
Kitzunu
2022-02-14 20:05:45 +01:00
committed by GitHub
parent 9b83abca39
commit 455899dc75
168 changed files with 438 additions and 438 deletions

View File

@@ -604,7 +604,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
m_attackTimer[type] = std::min(m_attackTimer[type] + time, time);
}
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinCombatRange(Unit const* obj, float dist2compare) const
{
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
return false;
@@ -620,7 +620,7 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
return distsq < maxdist * maxdist;
}
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
bool Unit::IsWithinMeleeRange(Unit const* obj, float dist) const
{
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
return false;
@@ -656,7 +656,7 @@ bool Unit::IsWithinRange(Unit const* obj, float dist) const
return distsq <= dist * dist;
}
bool Unit::GetRandomContactPoint(const Unit* obj, float& x, float& y, float& z, bool force) const
bool Unit::GetRandomContactPoint(Unit const* obj, float& x, float& y, float& z, bool force) const
{
float combat_reach = GetCombatReach();
if (combat_reach < 0.1f) // sometimes bugged for players
@@ -665,7 +665,7 @@ bool Unit::GetRandomContactPoint(const Unit* obj, float& x, float& y, float& z,
uint32 attacker_number = getAttackers().size();
if (attacker_number > 0)
--attacker_number;
const Creature* c = obj->ToCreature();
Creature const* c = obj->ToCreature();
if (c)
if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
@@ -2167,7 +2167,7 @@ void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
continue;
// Xinef: Single Target splits require LoS
const SpellInfo* splitSpellInfo = (*itr)->GetSpellInfo();
SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT))
if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
continue;
@@ -2465,7 +2465,7 @@ void Unit::HandleProcExtraAttackFor(Unit* victim)
}
}
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackType attType) const
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackType attType) const
{
// This is only wrapper
@@ -2488,7 +2488,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
}
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
{
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks())
{
@@ -2791,7 +2791,7 @@ bool Unit::isBlockCritical()
return false;
}
int32 Unit::GetMechanicResistChance(const SpellInfo* spell)
int32 Unit::GetMechanicResistChance(SpellInfo const* spell)
{
if (!spell)
return 0;
@@ -3285,7 +3285,7 @@ float Unit::GetUnitBlockChance() const
}
}
float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victim) const
float Unit::GetUnitCriticalChance(WeaponAttackType attackType, Unit const* victim) const
{
float crit;
@@ -4052,7 +4052,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
Unit* caster = aura->GetCaster();
// Update target aura state flag
const SpellInfo* spellInfo = aura->GetSpellInfo();
SpellInfo const* spellInfo = aura->GetSpellInfo();
if (AuraStateType aState = spellInfo->GetAuraState())
{
if (aState != AURA_STATE_CONFLAGRATE)
@@ -9504,7 +9504,7 @@ void Unit::setPowerType(Powers new_powertype)
break;
}
if (const Player* player = ToPlayer())
if (Player const* player = ToPlayer())
if (player->NeedSendSpectatorData())
{
ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
@@ -12721,7 +12721,7 @@ void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply,
}
}
void Unit::ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply)
void Unit::ApplySpellDispelImmunity(SpellInfo const* spellProto, DispelType type, bool apply)
{
ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
@@ -12756,7 +12756,7 @@ float Unit::GetWeaponProcChance() const
return 0;
}
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spellProto) const
{
// proc per minute chance calculation
if (PPM <= 0)
@@ -13216,7 +13216,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
repTargetToThis <= REP_NEUTRAL)
{
Player* owner = GetAffectingPlayer();
const Unit* const thisUnit = owner ? owner : this;
Unit const* const thisUnit = owner ? owner : this;
if (!(target->GetTypeId() == TYPEID_PLAYER && thisUnit->GetTypeId() == TYPEID_PLAYER) &&
!(target->GetTypeId() == TYPEID_UNIT && thisUnit->GetTypeId() == TYPEID_UNIT))
{
@@ -13489,7 +13489,7 @@ bool Unit::IsAlwaysDetectableFor(WorldObject const* seer) const
return true;
if (Player* ownerPlayer = GetSpellModOwner())
if (const Player* seerPlayer = seer->ToPlayer())
if (Player const* seerPlayer = seer->ToPlayer())
{
if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
return true;
@@ -15389,7 +15389,7 @@ bool InitTriggerAuraData()
return true;
}
void createProcFlags(const SpellInfo* spellInfo, WeaponAttackType attackType, bool positive, uint32& procAttacker, uint32& procVictim)
void createProcFlags(SpellInfo const* spellInfo, WeaponAttackType attackType, bool positive, uint32& procAttacker, uint32& procVictim)
{
if (spellInfo)
{
@@ -18132,8 +18132,8 @@ bool Unit::IsInPartyWith(Unit const* unit) const
if (this == unit)
return true;
const Unit* u1 = GetCharmerOrOwnerOrSelf();
const Unit* u2 = unit->GetCharmerOrOwnerOrSelf();
Unit const* u1 = GetCharmerOrOwnerOrSelf();
Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
if (u1 == u2)
return true;
@@ -18155,8 +18155,8 @@ bool Unit::IsInRaidWith(Unit const* unit) const
if (this == unit)
return true;
const Unit* u1 = GetCharmerOrOwnerOrSelf();
const Unit* u2 = unit->GetCharmerOrOwnerOrSelf();
Unit const* u1 = GetCharmerOrOwnerOrSelf();
Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
if (u1 == u2)
return true;
@@ -18341,7 +18341,7 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool
// Melee based spells can be miss, parry or dodge on this step
// Crit or block - determined on damage calculation phase! (and can be both in some time)
float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
{
SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
@@ -19680,7 +19680,7 @@ bool CharmInfo::IsReturning()
return _isReturning;
}
void Unit::PetSpellFail(const SpellInfo* spellInfo, Unit* target, uint32 result)
void Unit::PetSpellFail(SpellInfo const* spellInfo, Unit* target, uint32 result)
{
CharmInfo* charmInfo = GetCharmInfo();
if (!charmInfo || GetTypeId() != TYPEID_UNIT)