From 8aead2a1eea446c3a8ca40ac7c3c9ad13bc88ef9 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 20 Sep 2011 10:24:44 -0400 Subject: 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. --- src/server/game/Combat/ThreatManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/server/game/Combat/ThreatManager.cpp') diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 58d46dda62f..4d426d1a5af 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -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; -- cgit v1.2.3