aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorUjp8LfXBJ6wCPR <github@lillecarl.com>2020-02-29 13:22:51 +0100
committerGitHub <noreply@github.com>2020-02-29 13:22:51 +0100
commita933ba60151f478c7bae23dddbba315a448ffe3e (patch)
tree94692732da2de57d1804a67fe588b36ea5b25d3e /src/server/game/AI/ScriptedAI
parentfb75a958f02695f166481033203869940d98b537 (diff)
Modernize codebase with Clang-Tidy range based loops (#24165)
Manual expansion of auto types into "typed types"
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 9c9dfd8930b..65b805d246f 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -104,9 +104,9 @@ void SummonList::RemoveNotExisting()
bool SummonList::HasEntry(uint32 entry) const
{
- for (StorageType::const_iterator i = _storage.begin(); i != _storage.end(); ++i)
+ for (ObjectGuid const& guid : _storage)
{
- Creature* summon = ObjectAccessor::GetCreature(*_me, *i);
+ Creature* summon = ObjectAccessor::GetCreature(*_me, guid);
if (summon && summon->GetEntry() == entry)
return true;
}
@@ -116,7 +116,7 @@ bool SummonList::HasEntry(uint32 entry) const
void SummonList::DoActionImpl(int32 action, StorageType const& summons)
{
- for (auto const& guid : summons)
+ for (ObjectGuid const& guid : summons)
{
Creature* summon = ObjectAccessor::GetCreature(*_me, guid);
if (summon && summon->IsAIEnabled())
@@ -317,9 +317,9 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
SpellInfo const* tempSpell = nullptr;
// Check if each spell is viable(set it to null if not)
- for (uint32 i = 0; i < MAX_CREATURE_SPELLS; i++)
+ for (uint32 spell : me->m_spells)
{
- tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
+ tempSpell = sSpellMgr->GetSpellInfo(spell);
// This spell doesn't exist
if (!tempSpell)
@@ -327,11 +327,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
// Targets and Effects checked first as most used restrictions
// Check the spell targets if specified
- if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets-1))))
+ if (targets && !(SpellSummary[spell].Targets & (1 << (targets-1))))
continue;
// Check the type of spell if we are looking for a specific spell type
- if (effects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effects-1))))
+ if (effects && !(SpellSummary[spell].Effects & (1 << (effects-1))))
continue;
// Check for school if specified
@@ -405,9 +405,8 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
if (!map->IsDungeon())
return;
- Map::PlayerList const& PlayerList = map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
- if (Player* player = itr->GetSource())
+ for (MapReference const& mapref : map->GetPlayers())
+ if (Player* player = mapref.GetSource())
if (player->IsAlive())
player->TeleportTo(me->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
}