aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-09-20 10:24:44 -0400
committermegamage <none@none.none>2011-09-20 10:24:44 -0400
commit8aead2a1eea446c3a8ca40ac7c3c9ad13bc88ef9 (patch)
tree8a6a8080390631ef34e405b522463ff2a154ef16
parent3d4f9a0d1c1b5a3f17969615d8a6d495a0699e46 (diff)
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.
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp4
1 files changed, 4 insertions, 0 deletions
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;