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
+2 -2
View File
@@ -26,7 +26,7 @@
// AggressorAI
/////////////////
int AggressorAI::Permissible(const Creature* creature)
int AggressorAI::Permissible(Creature const* creature)
{
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
if (!creature->IsCivilian() && !creature->IsNeutralToAll())
@@ -226,7 +226,7 @@ TurretAI::TurretAI(Creature* c) : CreatureAI(c)
me->m_SightDistance = me->m_CombatDistance;
}
bool TurretAI::CanAIAttack(const Unit* /*who*/) const
bool TurretAI::CanAIAttack(Unit const* /*who*/) const
{
// TODO: use one function to replace it
if (!me->IsWithinCombatRange(me->GetVictim(), me->m_CombatDistance)
+2 -2
View File
@@ -31,7 +31,7 @@ public:
explicit AggressorAI(Creature* c) : CreatureAI(c) {}
void UpdateAI(uint32) override;
static int Permissible(const Creature*);
static int Permissible(Creature const*);
};
typedef std::vector<uint32> SpellVct;
@@ -83,7 +83,7 @@ struct TurretAI : public CreatureAI
{
public:
explicit TurretAI(Creature* c);
bool CanAIAttack(const Unit* who) const override;
bool CanAIAttack(Unit const* who) const override;
void AttackStart(Unit* who) override;
void UpdateAI(uint32 diff) override;
+1 -1
View File
@@ -18,7 +18,7 @@
#include "GameObjectAI.h"
//GameObjectAI::GameObjectAI(GameObject* g) : go(g) {}
int GameObjectAI::Permissible(const GameObject* go)
int GameObjectAI::Permissible(GameObject const* go)
{
if (go->GetAIName() == "GameObjectAI")
return PERMIT_BASE_SPECIAL;
+1 -1
View File
@@ -63,7 +63,7 @@ public:
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
virtual void EventInform(uint32 /*eventId*/) {}
virtual void SpellHit(Unit* /*unit*/, const SpellInfo* /*spellInfo*/) {}
virtual void SpellHit(Unit* /*unit*/, SpellInfo const* /*spellInfo*/) {}
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) { }
+3 -3
View File
@@ -30,7 +30,7 @@ public:
void AttackStart(Unit*) override {}
void UpdateAI(uint32) override;
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
static int Permissible(Creature const*) { return PERMIT_BASE_IDLE; }
};
class PossessedAI : public CreatureAI
@@ -46,7 +46,7 @@ public:
void JustDied(Unit*) override;
void KilledUnit(Unit* victim) override;
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
static int Permissible(Creature const*) { return PERMIT_BASE_IDLE; }
};
class NullCreatureAI : public CreatureAI
@@ -60,7 +60,7 @@ public:
void EnterEvadeMode() override {}
void OnCharmed(bool /*apply*/) override {}
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
static int Permissible(Creature const*) { return PERMIT_BASE_IDLE; }
};
class CritterAI : public PassiveAI
+3 -3
View File
@@ -28,7 +28,7 @@
#include "SpellMgr.h"
#include "Util.h"
int PetAI::Permissible(const Creature* creature)
int PetAI::Permissible(Creature const* creature)
{
if (creature->IsPet())
return PERMIT_BASE_SPECIAL;
@@ -567,7 +567,7 @@ void PetAI::HandleReturnMovement()
me->ClearInPetCombat();
}
void PetAI::SpellHit(Unit* caster, const SpellInfo* spellInfo)
void PetAI::SpellHit(Unit* caster, SpellInfo const* spellInfo)
{
// Xinef: taunt behavior code
if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE))
@@ -653,7 +653,7 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
}
}
bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
bool PetAI::CanAttack(Unit* target, SpellInfo const* spellInfo)
{
// Evaluates wether a pet can attack a specific target based on CommandState, ReactState and other flags
// IMPORTANT: The order in which things are checked is important, be careful if you add or remove checks
+3 -3
View File
@@ -49,7 +49,7 @@ public:
explicit PetAI(Creature* c);
void UpdateAI(uint32) override;
static int Permissible(const Creature*);
static int Permissible(Creature const*);
void KilledUnit(Unit* /*victim*/) override;
void AttackStart(Unit* target) override;
@@ -65,7 +65,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) override {} // CreatureAI interferes with returning pets
void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
void EnterEvadeMode() override {} // For fleeing, pets don't use this type of Evade mechanic
void SpellHit(Unit* caster, const SpellInfo* spellInfo) override;
void SpellHit(Unit* caster, SpellInfo const* spellInfo) override;
void PetStopAttack() override;
@@ -86,7 +86,7 @@ private:
Unit* SelectNextTarget(bool allowAutoSelect) const;
void HandleReturnMovement();
void DoAttack(Unit* target, bool chase);
bool CanAttack(Unit* target, const SpellInfo* spellInfo = nullptr);
bool CanAttack(Unit* target, SpellInfo const* spellInfo = nullptr);
void ClearCharmInfoFlags();
};
#endif
+1 -1
View File
@@ -19,7 +19,7 @@
#include "CreatureAIImpl.h"
#include "Errors.h"
int ReactorAI::Permissible(const Creature* creature)
int ReactorAI::Permissible(Creature const* creature)
{
if (creature->IsCivilian() || creature->IsNeutralToAll())
return PERMIT_BASE_REACTIVE;
+1 -1
View File
@@ -30,6 +30,6 @@ public:
void MoveInLineOfSight(Unit*) override {}
void UpdateAI(uint32 diff) override;
static int Permissible(const Creature*);
static int Permissible(Creature const*);
};
#endif
+1 -1
View File
@@ -38,7 +38,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c)
ASSERT(c->IsTotem());
}
void TotemAI::SpellHit(Unit* /*caster*/, const SpellInfo* /*spellInfo*/)
void TotemAI::SpellHit(Unit* /*caster*/, SpellInfo const* /*spellInfo*/)
{
}
+1 -1
View File
@@ -32,7 +32,7 @@ public:
void MoveInLineOfSight(Unit* who) override;
void AttackStart(Unit* victim) override;
void EnterEvadeMode() override;
void SpellHit(Unit* /*caster*/, const SpellInfo* /*spellInfo*/) override;
void SpellHit(Unit* /*caster*/, SpellInfo const* /*spellInfo*/) override;
void DoAction(int32 param) override;
void UpdateAI(uint32 diff) override;
+3 -3
View File
@@ -149,7 +149,7 @@ void UnitAI::DoCast(uint32 spellId)
break;
case AITARGET_ENEMY:
{
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_ON_PLAYER);
//float range = GetSpellMaxRange(spellInfo, false);
target = SelectTarget(SelectTargetMethod::Random, 0, spellInfo->GetMaxRange(false), playerOnly);
@@ -163,7 +163,7 @@ void UnitAI::DoCast(uint32 spellId)
break;
case AITARGET_DEBUFF:
{
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->HasAttribute(SPELL_ATTR3_ONLY_ON_PLAYER);
float range = spellInfo->GetMaxRange(false);
@@ -225,7 +225,7 @@ void UnitAI::FillAISpellInfo()
AISpellInfo = new AISpellInfoType[sSpellMgr->GetSpellInfoStoreSize()];
AISpellInfoType* AIInfo = AISpellInfo;
const SpellInfo* spellInfo;
SpellInfo const* spellInfo;
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i, ++AIInfo)
{
+2 -2
View File
@@ -41,7 +41,7 @@ enum class SelectTargetMethod
// default predicate function to select target based on distance, player and/or aura criteria
struct DefaultTargetSelector : public Acore::unary_function<Unit*, bool>
{
const Unit* me;
Unit const* me;
float m_dist;
bool m_playerOnly;
int32 m_aura;
@@ -167,7 +167,7 @@ struct FarthestTargetSelector : public Acore::unary_function<Unit*, bool>
}
private:
const Unit* _me;
Unit const* _me;
float _dist;
bool _playerOnly;
bool _inLos;
+2 -2
View File
@@ -34,7 +34,7 @@ struct CreatureAIFactory : public SelectableAI
CreatureAI* Create(void*) const;
int Permit(const Creature* c) const { return REAL_AI::Permissible(c); }
int Permit(Creature const* c) const { return REAL_AI::Permissible(c); }
};
template<class REAL_AI>
@@ -61,7 +61,7 @@ struct GameObjectAIFactory : public SelectableGameObjectAI
GameObjectAI* Create(void*) const;
int Permit(const GameObject* g) const { return REAL_GO_AI::Permissible(g); }
int Permit(GameObject const* g) const { return REAL_GO_AI::Permissible(g); }
};
template<class REAL_GO_AI>
+6 -6
View File
@@ -698,7 +698,7 @@ void SmartAI::MoveInLineOfSight(Unit* who)
}
}
bool SmartAI::CanAIAttack(const Unit* /*who*/) const
bool SmartAI::CanAIAttack(Unit const* /*who*/) const
{
if (me->GetReactState() == REACT_PASSIVE)
return false;
@@ -754,7 +754,7 @@ void SmartAI::JustRespawned()
mFollowArrivedAlive = true;
}
int SmartAI::Permissible(const Creature* creature)
int SmartAI::Permissible(Creature const* creature)
{
if (creature->GetAIName() == "SmartAI")
return PERMIT_BASE_SPECIAL;
@@ -832,12 +832,12 @@ void SmartAI::AttackStart(Unit* who)
}
}
void SmartAI::SpellHit(Unit* unit, const SpellInfo* spellInfo)
void SmartAI::SpellHit(Unit* unit, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
}
void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::SpellHitTarget(Unit* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, spellInfo);
}
@@ -1101,7 +1101,7 @@ void SmartGameObjectAI::SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
GetScript()->ProcessEventsFor(SMART_EVENT_SUMMONED_UNIT_DIES, summon);
}
int SmartGameObjectAI::Permissible(const GameObject* g)
int SmartGameObjectAI::Permissible(GameObject const* g)
{
if (g->GetAIName() == "SmartGameObjectAI")
return PERMIT_BASE_SPECIAL;
@@ -1199,7 +1199,7 @@ void SmartGameObjectAI::EventInform(uint32 eventId)
GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, nullptr, eventId);
}
void SmartGameObjectAI::SpellHit(Unit* unit, const SpellInfo* spellInfo)
void SmartGameObjectAI::SpellHit(Unit* unit, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
}
+6 -6
View File
@@ -101,10 +101,10 @@ public:
void MoveInLineOfSight(Unit* who) override;
// Called when hit by a spell
void SpellHit(Unit* unit, const SpellInfo* spellInfo) override;
void SpellHit(Unit* unit, SpellInfo const* spellInfo) override;
// Called when spell hits a target
void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) override;
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override;
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* done_by, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override;
@@ -146,7 +146,7 @@ public:
void OnCharmed(bool apply) override;
// Called when victim is in line of sight
bool CanAIAttack(const Unit* who) const override;
bool CanAIAttack(Unit const* who) const override;
// Used in scripts to share variables
void DoAction(int32 param = 0) override;
@@ -164,7 +164,7 @@ public:
ObjectGuid GetGUID(int32 id = 0) const override;
//core related
static int32 Permissible(const Creature*);
static int32 Permissible(Creature const*);
// Called at movepoint reached
void MovepointReached(uint32 id);
@@ -258,7 +258,7 @@ public:
void InitializeAI() override;
void Reset() override;
SmartScript* GetScript() { return &mScript; }
static int32 Permissible(const GameObject* g);
static int32 Permissible(GameObject const* g);
bool GossipHello(Player* player, bool reportUse) override;
bool GossipSelect(Player* player, uint32 sender, uint32 action) override;
@@ -271,7 +271,7 @@ public:
void OnGameEvent(bool start, uint16 eventId) override;
void OnStateChanged(uint32 state, Unit* unit) override;
void EventInform(uint32 eventId) override;
void SpellHit(Unit* unit, const SpellInfo* spellInfo) override;
void SpellHit(Unit* unit, SpellInfo const* spellInfo) override;
// Called when a summoned unit dies
void SummonedCreatureDies(Creature* summon, Unit* killer) override;
@@ -97,7 +97,7 @@ void SmartScript::OnReset()
RestoreCasterMaxDist();
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, SpellInfo const* spell, GameObject* gob)
{
for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i)
{
@@ -116,7 +116,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3
}
}
void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, SpellInfo const* spell, GameObject* gob)
{
//calc random
if (e.GetEventType() != SMART_EVENT_LINK && e.event.event_chance < 100 && e.event.event_chance)
@@ -3410,7 +3410,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
}
void SmartScript::ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
void SmartScript::ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit, uint32 var0, uint32 var1, bool bvar, SpellInfo const* spell, GameObject* gob)
{
// xinef: extended by selfs victim
ConditionList const conds = sConditionMgr->GetConditionsForSmartEvent(e.entryOrGuid, e.event_id, e.source_type);
@@ -4016,7 +4016,7 @@ ObjectList* SmartScript::GetWorldObjectsInDist(float dist)
return targets;
}
void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, SpellInfo const* spell, GameObject* gob)
{
if (!e.active && e.GetEventType() != SMART_EVENT_LINK)
return;
@@ -4928,7 +4928,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTrigger const* at)
// Xinef: if smartcast combat move flag is present
if (i->GetActionType() == SMART_ACTION_CAST && (i->action.cast.flags & SMARTCAST_COMBAT_MOVE))
{
if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(i->action.cast.spell))
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i->action.cast.spell))
{
float maxRange = spellInfo->GetMaxRange(spellInfo->IsPositive());
float minRange = spellInfo->GetMinRange(spellInfo->IsPositive());
@@ -36,14 +36,14 @@ public:
void GetScript();
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at);
void ProcessEventsFor(SMART_EVENT e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = nullptr, GameObject* gob = nullptr);
void ProcessEvent(SmartScriptHolder& e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = nullptr, GameObject* gob = nullptr);
void ProcessEventsFor(SMART_EVENT e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, SpellInfo const* spell = nullptr, GameObject* gob = nullptr);
void ProcessEvent(SmartScriptHolder& e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, SpellInfo const* spell = nullptr, GameObject* gob = nullptr);
bool CheckTimer(SmartScriptHolder const& e) const;
void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max);
void UpdateTimer(SmartScriptHolder& e, uint32 const diff);
void InitTimer(SmartScriptHolder& e);
void ProcessAction(SmartScriptHolder& e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = nullptr, GameObject* gob = nullptr);
void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = nullptr, GameObject* gob = nullptr);
void ProcessAction(SmartScriptHolder& e, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, SpellInfo const* spell = nullptr, GameObject* gob = nullptr);
void ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit = nullptr, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, SpellInfo const* spell = nullptr, GameObject* gob = nullptr);
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr);
ObjectList* GetWorldObjectsInDist(float dist);
void InstallTemplate(SmartScriptHolder const& e);