3dcd49e v2, slightly cheaper

(cherry picked from commit b53cbf467b445a9b57a5567f88a26f77289f7fe1)
This commit is contained in:
Treeston
2021-05-17 00:06:52 +02:00
committed by Shauren
parent 7cd61b581c
commit 563188fe4b
+3 -3
View File
@@ -342,10 +342,10 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell
if (!redirInfo.empty())
{
float const origAmount = amount;
// intentional copy - there's a nested AddThreat call further down that might cause AI calls which cast spells
auto const redirects = redirInfo;
for (auto const& pair : redirects) // (victim,pct)
// intentional iteration by index - there's a nested AddThreat call further down that might cause AI calls which might modify redirect info through spells
for (size_t i=0; i<redirInfo.size(); ++i)
{
auto const pair = redirInfo[i]; // (victim,pct)
Unit* redirTarget = nullptr;
auto it = _myThreatListEntries.find(pair.first); // try to look it up in our threat list first (faster)
if (it != _myThreatListEntries.end())