diff options
Diffstat (limited to 'src')
13 files changed, 17 insertions, 20 deletions
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index fcc0f82a220..a6432d62216 100644 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -222,6 +222,7 @@ class TC_GAME_API ThreatManager // -- compatibility layer for combat rewrite (PR #19930) Trinity::Containers::IteratorPair<std::list<ThreatReference*>::const_iterator> GetSortedThreatList() const { auto& list = iThreatContainer.getThreatList(); return { list.cbegin(), list.cend() }; } Trinity::Containers::IteratorPair<std::list<ThreatReference*>::const_iterator> GetUnsortedThreatList() const { return GetSortedThreatList(); } + std::list<ThreatReference*> GetModifiableThreatList() const { return iThreatContainer.getThreatList(); } Unit* SelectVictim() { return getHostilTarget(); } Unit* GetCurrentVictim() const { if (ThreatReference* ref = getCurrentVictim()) return ref->GetVictim(); else return nullptr; } bool IsThreatListEmpty(bool includeOffline = false) const { return includeOffline ? areThreatListsEmpty() : isThreatListEmpty(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 837fdad72b3..fcd307ada07 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -319,7 +319,7 @@ public: Unit* tank = me->GetThreatManager().GetCurrentVictim(); std::vector<Unit*> targets; - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) { Unit* target = ref->GetVictim(); if (target != tank && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 5dbd255ecd2..15471eacc2d 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -991,7 +991,7 @@ public: if (FelfirePortalTimer <= diff) { if (Creature* pPortal = DoSpawnCreature(NPC_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) AddThreat(ref->GetVictim(), 1.0f, pPortal); FelfirePortalTimer = 20000; } else FelfirePortalTimer -= diff; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 55dfdc8e2d5..53d382f0961 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -148,7 +148,7 @@ class boss_moam : public CreatureScript { std::list<Unit*> targetList; { - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) if (ref->GetVictim()->GetTypeId() == TYPEID_PLAYER && ref->GetVictim()->getPowerType() == POWER_MANA) targetList.push_back(ref->GetVictim()); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index e5eab1ecda3..c657a47ddcb 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -650,7 +650,7 @@ public: //Place all units in threat list on outside of stomach Stomach_Map.clear(); - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) Stomach_Map[ref->GetVictim()->GetGUID()] = false; //Outside stomach //Spawn 2 flesh tentacles diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index d4fade43ba4..433721e70bd 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -611,7 +611,7 @@ struct boss_faction_championsAI : public BossAI void UpdateThreat() { - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference* ref : me->GetThreatManager().GetModifiableThreatList()) if (Player* victim = ref->GetVictim()->ToPlayer()) ref->SetThreat(1000000.0f * CalculateThreat(me->GetDistance2d(victim), victim->GetArmor(), victim->GetHealth())); } @@ -696,7 +696,7 @@ struct boss_faction_championsAI : public BossAI uint32 EnemiesInRange(float distance) { uint32 count = 0; - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) if (me->GetDistance2d(ref->GetVictim()) < distance) ++count; return count; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1bedf9f7961..326a78c03c4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -960,12 +960,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript void DeleteAllFromThreatList(Unit* target, ObjectGuid except) { - std::vector<ThreatReference*> toClear; - for (ThreatReference* ref : target->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference* ref : target->GetThreatManager().GetModifiableThreatList()) if (ref->GetVictim()->GetGUID() != except) - toClear.push_back(ref); - for (ThreatReference* ref : toClear) - ref->ClearThreat(); + ref->ClearThreat(); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 30d57d99a75..8ed22cce7be 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -489,7 +489,7 @@ class boss_blood_queen_lana_thel : public CreatureScript std::list<Player*> tempTargets; Unit* maintank = me->GetThreatManager().GetCurrentVictim(); - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) if (Player* refTarget = ref->GetVictim()->ToPlayer()) if (refTarget != maintank && (includeOfftank || (refTarget->GetGUID() != _offtankGUID))) tempTargets.push_back(refTarget->ToPlayer()); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 63d3af3931a..ce92ffc6abc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -503,7 +503,7 @@ class boss_professor_putricide : public CreatureScript { std::list<Unit*> targetList; { - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) if (Player* target = ref->GetVictim()->ToPlayer()) targetList.push_back(target); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index c1fdc5b950e..46ab982c8a9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -124,8 +124,8 @@ public: ThreatManager const& mgr = me->GetThreatManager(); Unit* currentVictim = mgr.GetCurrentVictim(); - auto const& pair = mgr.GetSortedThreatList(); - auto it = pair.begin(), end = pair.end(); + auto list = mgr.GetModifiableThreatList(); + auto it = list.begin(), end = list.end(); if (it == end) EnterEvadeMode(EVADE_REASON_NO_HOSTILES); @@ -151,8 +151,7 @@ public: DoCast(pHatefulTarget, SPELL_HATEFUL_STRIKE, true); // add threat to highest threat targets - if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - AddThreat(me->GetVictim(), HATEFUL_THREAT_AMT); + AddThreat(currentVictim, HATEFUL_THREAT_AMT); if (secondThreat) secondThreat->AddThreat(HATEFUL_THREAT_AMT); if (thirdThreat) diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index b6dd3924c06..553300715e5 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -1827,7 +1827,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader { if (Creature* caster = GetCaster()->ToCreature()) { - for (ThreatReference* ref : caster->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : caster->GetThreatManager().GetUnsortedThreatList()) { if (Player* targetPlayer = ref->GetVictim()->ToPlayer()) { diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index 10647a1c1de..e5458ac1b10 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -110,7 +110,7 @@ class boss_blackheart_the_inciter : public CreatureScript { DoCast(me, SPELL_INCITE_CHAOS); - for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (ThreatReference const* ref : me->GetThreatManager().GetUnsortedThreatList()) if (ref->GetVictim()->GetTypeId() == TYPEID_PLAYER) me->CastSpell(ref->GetVictim(), SPELL_INCITE_CHAOS_B, true); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 36963a137c2..29185f77185 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -529,7 +529,7 @@ public: ThreatManager const& mgr = me->GetThreatManager(); std::list<Unit*> TargetList; Unit* currentVictim = mgr.GetCurrentVictim(); - for (ThreatReference* ref : mgr.GetSortedThreatList()) + for (ThreatReference const* ref : mgr.GetSortedThreatList()) { if (Player* tempTarget = ref->GetVictim()->ToPlayer()) if (tempTarget != currentVictim && TargetList.size()<5) |