aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorUjp8LfXBJ6wCPR <github@lillecarl.com>2020-02-29 13:22:51 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-22 16:42:54 +0100
commitee5384a15d440c89d89a9c10582cca5c840d4fdf (patch)
tree6aa35d408237d67bc7eb627b8be63dd7a87ac27c /src/server/game/AI/ScriptedAI
parent43aa763d04b524f50c73b55802b11780b75a2f82 (diff)
Modernize codebase with Clang-Tidy range based loops (#24165)
Manual expansion of auto types into "typed types" (cherry picked from commit a933ba60151f478c7bae23dddbba315a448ffe3e)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 2a94a0e69fa..7b73dcc833c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -97,9 +97,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;
}
@@ -109,7 +109,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,10 +317,10 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
AISpellInfoType const* aiSpell = 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], me->GetMap()->GetDifficultyID());
- aiSpell = GetAISpellInfo(me->m_spells[i], me->GetMap()->GetDifficultyID());
+ tempSpell = sSpellMgr->GetSpellInfo(spell, me->GetMap()->GetDifficultyID());
+ aiSpell = GetAISpellInfo(spell, me->GetMap()->GetDifficultyID());
// This spell doesn't exist
if (!tempSpell || !aiSpell)
@@ -409,9 +409,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);
}