From 618e604141c3b2eaa37386be07eb3b9d80a949eb Mon Sep 17 00:00:00 2001 From: treeston Date: Mon, 3 Jul 2017 17:49:54 +0200 Subject: [PATCH] Two more refactors I missed for #19930. Last ones for now, I promise. --- src/server/game/AI/CoreAI/UnitAI.h | 8 ++++---- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 5894677ebdd..c23c13641d6 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -172,7 +172,7 @@ class TC_GAME_API UnitAI std::list targetList; if (targetType == SELECT_TARGET_MAXDISTANCE || targetType == SELECT_TARGET_MINDISTANCE) { - for (ThreatReference* ref : mgr.GetUnsortedThreatList()) + for (ThreatReference const* ref : mgr.GetUnsortedThreatList()) { if (ref->IsOffline()) continue; @@ -186,7 +186,7 @@ class TC_GAME_API UnitAI if (currentVictim) targetList.push_back(currentVictim); - for (ThreatReference* ref : mgr.GetSortedThreatList()) + for (ThreatReference const* ref : mgr.GetSortedThreatList()) { if (ref->IsOffline()) continue; @@ -261,7 +261,7 @@ class TC_GAME_API UnitAI if (targetType == SELECT_TARGET_MAXDISTANCE || targetType == SELECT_TARGET_MINDISTANCE) { - for (ThreatReference* ref : mgr.GetUnsortedThreatList()) + for (ThreatReference const* ref : mgr.GetUnsortedThreatList()) { if (ref->IsOffline()) continue; @@ -275,7 +275,7 @@ class TC_GAME_API UnitAI if (currentVictim) targetList.push_back(currentVictim); - for (ThreatReference* ref : mgr.GetSortedThreatList()) + for (ThreatReference const* ref : mgr.GetSortedThreatList()) { if (ref->IsOffline()) continue; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 5f2a65a31d3..1a7ff4542b6 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -494,7 +494,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!me) break; - for (auto* ref : me->GetThreatManager().GetUnsortedThreatList()) + for (auto* ref : me->GetThreatManager().GetModifiableThreatList()) { ref->ModifyThreatByPercent(std::max(-100, int32(e.action.threatPCT.threatINC) - int32(e.action.threatPCT.threatDEC))); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i",