mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
3dcd49e v2, slightly cheaper
This commit is contained in:
@@ -333,10 +333,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())
|
||||
|
||||
Reference in New Issue
Block a user