diff options
| author | Anubisss <none@none> | 2010-04-02 15:41:37 +0200 |
|---|---|---|
| committer | Anubisss <none@none> | 2010-04-02 15:41:37 +0200 |
| commit | 08b4748e622a91b86b1918400836f862133cbf71 (patch) | |
| tree | 0f0a582a6ce9ef3c4f01dc089af56014c16f9126 /src/scripts/outland | |
| parent | 7c4f2f520f4047b10d94e44f6af1c910ff4bdbcf (diff) | |
Use GUIDs instead of "global" pointers in zone scripts.
This commit is like that: 7714 / rce505237e4aa
And use const_iterators where it is possible.
--HG--
branch : trunk
Diffstat (limited to 'src/scripts/outland')
20 files changed, 47 insertions, 47 deletions
diff --git a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp index 9535be2bae1..d7c04a35c9c 100644 --- a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp +++ b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp @@ -122,7 +122,7 @@ struct boss_blackheart_the_inciterAI : public ScriptedAI DoCast(m_creature, SPELL_INCITE_CHAOS); std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) diff --git a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp index a02148d4758..61c4c6dce64 100644 --- a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp +++ b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp @@ -68,7 +68,7 @@ struct boss_murmurAI : public ScriptedAI void SonicBoomEffect() { std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) @@ -153,7 +153,7 @@ struct boss_murmurAI : public ScriptedAI if (ThunderingStorm_Timer <= diff) { std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false)) DoCast(pTarget, SPELL_THUNDERING_STORM, true); @@ -176,7 +176,7 @@ struct boss_murmurAI : public ScriptedAI if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) { std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget)) { diff --git a/src/scripts/outland/black_temple/boss_bloodboil.cpp b/src/scripts/outland/black_temple/boss_bloodboil.cpp index 150b631e641..b1fce8d4d42 100644 --- a/src/scripts/outland/black_temple/boss_bloodboil.cpp +++ b/src/scripts/outland/black_temple/boss_bloodboil.cpp @@ -136,7 +136,7 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI return; std::list<Unit *> targets; - std::list<HostileReference *>::iterator itr = m_threatlist.begin(); + std::list<HostileReference *>::const_iterator itr = m_threatlist.begin(); for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); @@ -154,7 +154,7 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL); if (spellInfo) { - for (std::list<Unit *>::iterator itr = targets.begin(); itr != targets.end(); ++itr) + for (std::list<Unit *>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) { Unit *pTarget = *itr; if (!pTarget) return; diff --git a/src/scripts/outland/black_temple/boss_illidan.cpp b/src/scripts/outland/black_temple/boss_illidan.cpp index ed1b1d4df02..54e2139c4ca 100644 --- a/src/scripts/outland/black_temple/boss_illidan.cpp +++ b/src/scripts/outland/black_temple/boss_illidan.cpp @@ -501,7 +501,7 @@ struct boss_illidan_stormrageAI : public ScriptedAI void DeleteFromThreatList(uint64 TargetGUID) { - for (std::list<HostileReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) + for (std::list<HostileReference*>::const_iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) { if ((*itr)->getUnitGuid() == TargetGUID) { @@ -1072,13 +1072,13 @@ struct npc_akama_illidanAI : public ScriptedAI { std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList(); std::vector<Unit*> eliteList; - for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) eliteList.push_back(pUnit); } - for (std::vector<Unit*>::iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) + for (std::vector<Unit*>::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) (*itr)->setDeathState(JUST_DIED); EnterEvadeMode(); } diff --git a/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp b/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp index 6504b9918aa..6d23761aa52 100644 --- a/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp +++ b/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp @@ -189,8 +189,8 @@ struct boss_reliquary_of_soulsAI : public ScriptedAI return; std::list<HostileReference*>& m_threatlist = pTarget->getThreatManager().getThreatList(); - std::list<HostileReference*>::iterator itr = m_threatlist.begin(); - for (; itr != m_threatlist.end(); itr++) + std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); + for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit) @@ -390,7 +390,7 @@ struct boss_essence_of_sufferingAI : public ScriptedAI if (m_threatlist.empty()) return; // No point continuing if empty threatlist. std::list<Unit*> targets; - std::list<HostileReference*>::iterator itr = m_threatlist.begin(); + std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_shade_of_akama.cpp b/src/scripts/outland/black_temple/boss_shade_of_akama.cpp index 23d298ff05c..7c1e5406d69 100644 --- a/src/scripts/outland/black_temple/boss_shade_of_akama.cpp +++ b/src/scripts/outland/black_temple/boss_shade_of_akama.cpp @@ -259,7 +259,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI if (!Channelers.empty()) { - for (std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) { Creature* Channeler = (Unit::GetCreature(*m_creature, *itr)); if (Channeler) @@ -347,7 +347,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI if (!ChannelerList.empty()) { - for (std::list<Creature*>::iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) + for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) { CAST_AI(mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = m_creature->GetGUID(); Channelers.push_back((*itr)->GetGUID()); @@ -365,7 +365,7 @@ struct boss_shade_of_akamaAI : public ScriptedAI return; } - for (std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) if (Creature* Channeler = (Unit::GetCreature(*m_creature, *itr))) Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -743,7 +743,7 @@ struct npc_akamaAI : public ScriptedAI if (!BrokenList.empty()) { bool Yelled = false; - for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) { if (!Yelled) @@ -760,7 +760,7 @@ struct npc_akamaAI : public ScriptedAI case 3: if (!BrokenList.empty()) { - for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature(*m_creature, *itr)) // This is the incorrect spell, but can't seem to find the right one. pUnit->CastSpell(pUnit, 39656, true); @@ -771,7 +771,7 @@ struct npc_akamaAI : public ScriptedAI case 4: if (!BrokenList.empty()) { - for (std::list<uint64>::iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) if (Creature* pUnit = Unit::GetCreature((*m_creature), *itr)) pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); } diff --git a/src/scripts/outland/black_temple/boss_supremus.cpp b/src/scripts/outland/black_temple/boss_supremus.cpp index 24f75d5d1e0..c7cc7055ffa 100644 --- a/src/scripts/outland/black_temple/boss_supremus.cpp +++ b/src/scripts/outland/black_temple/boss_supremus.cpp @@ -150,7 +150,7 @@ struct boss_supremusAI : public ScriptedAI Unit *pTarget = NULL; std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list<HostileReference*>::iterator i = m_threatlist.begin(); + std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp b/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp index c12bbd4249c..7be98d4b986 100644 --- a/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp +++ b/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp @@ -145,7 +145,7 @@ struct mob_shadowy_constructAI : public ScriptedAI std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return; // No threat list. Don't continue. - std::list<HostileReference*>::iterator itr = m_threatlist.begin(); + std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); std::list<Unit*> targets; for (; itr != m_threatlist.end(); ++itr) { @@ -283,7 +283,7 @@ struct boss_teron_gorefiendAI : public ScriptedAI if (!Blossom) return; std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list<HostileReference*>::iterator i = m_threatlist.begin(); + std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_warlord_najentus.cpp b/src/scripts/outland/black_temple/boss_warlord_najentus.cpp index 230660214a8..12f1eb80975 100644 --- a/src/scripts/outland/black_temple/boss_warlord_najentus.cpp +++ b/src/scripts/outland/black_temple/boss_warlord_najentus.cpp @@ -175,7 +175,7 @@ struct boss_najentusAI : public ScriptedAI //DoCast(m_creature, SPELL_NEEDLE_SPINE, true); std::list<Unit*> pTargets; SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true); - for (std::list<Unit*>::iterator i = pTargets.begin(); i != pTargets.end(); ++i) + for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) DoCast(*i, 39835, true); events.ScheduleEvent(EVENT_NEEDLE, urand(15000,25000), GCD_CAST); events.DelayEvents(1500, GCD_CAST); diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index c3d50b78fda..9fc49e584cb 100644 --- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -440,7 +440,7 @@ struct boss_lady_vashjAI : public ScriptedAI bool InMeleeRange = false; Unit *pTarget; std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //if in melee range diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index 37b859a4097..02911782b1c 100644 --- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -480,14 +480,14 @@ struct boss_leotheras_the_blindAI : public ScriptedAI { std::list<HostileReference *>& ThreatList = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> TargetList; - for (std::list<HostileReference *>::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) TargetList.push_back(tempTarget); } SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); - for (std::vector<Unit *>::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + for (std::vector<Unit *>::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) { if ((*itr) && (*itr)->isAlive()) { diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp index ca4dfebb477..156d57cb47a 100644 --- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -223,7 +223,7 @@ struct boss_morogrim_tidewalkerAI : public ScriptedAI Unit *pTarget; using std::set; set<int>list; - set<int>::iterator itr; + set<int>::const_iterator itr; for (uint8 i = 0; i < 4; ++i) { counter = 0; @@ -262,7 +262,7 @@ struct boss_morogrim_tidewalkerAI : public ScriptedAI Unit* pGlobuleTarget; using std::set; set<int>globulelist; - set<int>::iterator itr; + set<int>::const_iterator itr; for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD { counter = 0; diff --git a/src/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp b/src/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp index 528e294b156..9be8d3294d5 100644 --- a/src/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp +++ b/src/scripts/outland/coilfang_resevoir/underbog/boss_the_black_stalker.cpp @@ -78,7 +78,7 @@ struct boss_the_black_stalkerAI : public ScriptedAI void JustDied(Unit *who) { - for (std::list<uint64>::iterator i = Striders.begin(); i != Striders.end(); ++i) + for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i) if (Creature *strider = Unit::GetCreature(*m_creature, *i)) strider->DisappearAndDie(); } diff --git a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp index 4e586b2057f..2af55ffa15e 100644 --- a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp +++ b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp @@ -708,7 +708,7 @@ struct boss_krosh_firehandAI : public ScriptedAI Unit *pTarget; std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> target_list; - for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //15 yard radius minimum diff --git a/src/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp b/src/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp index aabb4e86a3a..cb072c1d74b 100644 --- a/src/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp +++ b/src/scripts/outland/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp @@ -135,7 +135,7 @@ struct instance_magtheridons_lair : public ScriptedInstance if (m_auiEncounter[1] != NOT_STARTED) { m_auiEncounter[1] = NOT_STARTED; - for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature *Channeler = instance->GetCreature(*i)) { @@ -154,7 +154,7 @@ struct instance_magtheridons_lair : public ScriptedInstance { m_auiEncounter[1] = IN_PROGRESS; // Let all five channelers aggro. - for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature *Channeler = instance->GetCreature(*i); if (Channeler && Channeler->isAlive()) @@ -171,7 +171,7 @@ struct instance_magtheridons_lair : public ScriptedInstance } break; case DONE: // Add buff and check if all channelers are dead. - for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { Creature *Channeler = instance->GetCreature(*i); if (Channeler && Channeler->isAlive()) @@ -187,7 +187,7 @@ struct instance_magtheridons_lair : public ScriptedInstance break; case DATA_COLLAPSE: // true - collapse / false - reset - for (std::set<uint64>::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) + for (std::set<uint64>::const_iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) DoUseDoorOrButton(*i); break; default: @@ -222,7 +222,7 @@ struct instance_magtheridons_lair : public ScriptedInstance { if (RespawnTimer <= diff) { - for (std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) + for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) { if (Creature *Channeler = instance->GetCreature(*i)) { diff --git a/src/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp b/src/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp index 5c7ce1d1aef..0b1b3ab8428 100644 --- a/src/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp +++ b/src/scripts/outland/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp @@ -144,7 +144,7 @@ struct boss_warchief_kargath_bladefistAI : public ScriptedAI void removeAdds() { - for (std::vector<uint64>::iterator itr = adds.begin(); itr!= adds.end(); ++itr) + for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) { Unit* temp = Unit::GetUnit((*m_creature),*itr); if (temp && temp->isAlive()) @@ -156,7 +156,7 @@ struct boss_warchief_kargath_bladefistAI : public ScriptedAI } adds.clear(); - for (std::vector<uint64>::iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) + for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { Unit* temp = Unit::GetUnit((*m_creature),*itr); if (temp && temp->isAlive()) diff --git a/src/scripts/outland/netherstorm.cpp b/src/scripts/outland/netherstorm.cpp index 25dba020be4..992a4f2dc85 100644 --- a/src/scripts/outland/netherstorm.cpp +++ b/src/scripts/outland/netherstorm.cpp @@ -79,7 +79,7 @@ struct npc_manaforge_control_consoleAI : public ScriptedAI Wave = false; someplayer = 0; goConsole = 0; - Creature* add = NULL; + add = NULL; } void EnterCombat(Unit *who) { return; } @@ -296,8 +296,7 @@ bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) pPlayer->SendPreparedQuest(pGo->GetGUID()); } - Creature* manaforge; - manaforge = NULL; + Creature* manaforge = NULL; switch(pGo->GetAreaId()) { @@ -696,6 +695,7 @@ struct mob_phase_hunterAI : public ScriptedAI float HpPercent; Player *pPlayer; + uint64 PlayerGUID; uint32 ManaBurnTimer; @@ -707,7 +707,7 @@ struct mob_phase_hunterAI : public ScriptedAI WeakPercent = 25 + (rand() % 16); // 25-40 HpPercent = 0.0f; - pPlayer = NULL; + PlayerGUID = 0; ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd @@ -718,7 +718,7 @@ struct mob_phase_hunterAI : public ScriptedAI void EnterCombat(Unit *who) { if (who->GetTypeId() == TYPEID_PLAYER) - pPlayer = CAST_PLR(who); + PlayerGUID = who->GetGUID(); } void SpellHit(Unit *caster, const SpellEntry *spell) @@ -765,7 +765,7 @@ struct mob_phase_hunterAI : public ScriptedAI ManaBurnTimer = 3500; } else ManaBurnTimer -= diff; - if (pPlayer) // start: support for quest 10190 + if (Player *pPlayer = Unit::GetPlayer(PlayerGUID)) // start: support for quest 10190 { if (!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE) diff --git a/src/scripts/outland/shadowmoon_valley.cpp b/src/scripts/outland/shadowmoon_valley.cpp index cd9a253d4cb..3a6a86613f9 100644 --- a/src/scripts/outland/shadowmoon_valley.cpp +++ b/src/scripts/outland/shadowmoon_valley.cpp @@ -1496,7 +1496,7 @@ struct npc_lord_illidan_stormrageAI : public ScriptedAI const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { GroupMember = (Unit::GetPlayer(itr->guid)); if (!GroupMember) @@ -1522,7 +1522,7 @@ struct npc_lord_illidan_stormrageAI : public ScriptedAI if (GroupMemberCount == DeadMemberCount) { - for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { GroupMember = Unit::GetPlayer(itr->guid); diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp index 0fc0c57d2e2..2f56606a031 100644 --- a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp @@ -851,7 +851,7 @@ struct boss_kaelthasAI : public ScriptedAI //GravityLapse_Timer if (GravityLapse_Timer <= diff) { - std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin(); switch (GravityLapse_Phase) { case 0: @@ -1197,7 +1197,7 @@ struct boss_grand_astromancer_capernianAI : public advisorbase_ai bool InMeleeRange = false; Unit *pTarget = NULL; std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); //if in melee range diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp index 84dd5af73d0..e6823106ad8 100644 --- a/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp +++ b/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp @@ -111,7 +111,7 @@ struct boss_void_reaverAI : public ScriptedAI Unit *pTarget = NULL; std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> target_list; - for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!pTarget) |
