Do not add spell-caused threat to creatures in other map or phase. Fix crashes #2396 and #2992.

Note: Threat system is still thread-unsafe. This patch only reduces the chance of crash.
This commit is contained in:
megamage
2011-09-20 10:24:44 -04:00
parent 3d4f9a0d1c
commit 8aead2a1ee

View File

@@ -74,6 +74,10 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
if (!hatedUnit->isAlive() || !hatingUnit->isAlive())
return false;
// not in same map or phase
if (!hatedUnit->IsInMap(hatingUnit))
return false;
// spell not causing threat
if (threatSpell && threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT)
return false;