diff options
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 17 |
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); } |