diff options
-rw-r--r-- | src/game/Unit.cpp | 11 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 70a03d75379..72e8deb010c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -152,7 +152,7 @@ bool IsPassiveStackableSpell( uint32 spellId ) Unit::Unit() : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) , m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false) -, i_AI(NULL), i_disabledAI(NULL) +, i_AI(NULL), i_disabledAI(NULL), m_procDeep(0) { m_objectType |= TYPEMASK_UNIT; m_objectTypeId = TYPEID_UNIT; @@ -11409,16 +11409,15 @@ uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missC return procEx; } -static int deep = 0; void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage ) { - deep ++; - if (deep > 5) + ++m_procDeep; + if (++m_procDeep > 5) { sLog.outError("Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor"); if (procSpell) sLog.outError(" Spell %u", procSpell->Id); - deep--; + --m_procDeep; return; } // For melee/ranged based attack need update skills and set some Aura states @@ -11675,7 +11674,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();i++) RemoveAurasDueToSpell(*i); } - deep--; + --m_procDeep; } SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const diff --git a/src/game/Unit.h b/src/game/Unit.h index 89c0ddad86a..0179097de77 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1532,6 +1532,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject uint32 m_reducedThreatPercent; uint64 m_misdirectionTargetGUID; + + uint32 m_procDeep; }; namespace Trinity |