diff options
author | megamage <none@none> | 2009-01-14 19:54:55 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-14 19:54:55 -0600 |
commit | fcd3a315422c629b313033f9530ba89773c2b332 (patch) | |
tree | a695491a55d37528656e64513813465b34634c78 /src | |
parent | 1e92a75f8fc08cf61732aeeac963302551d24a10 (diff) |
*Fix a bug in removeaura.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Unit.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e8ba2b815ab..c828aa30129 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4596,6 +4596,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aura* Aur = i->second; SpellEntry const* AurSpellInfo = Aur->GetSpellProto(); + // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura + // remove aura from list before to prevent deleting it before + m_Auras.erase(i); + ++m_removedAuras; // internal count used by unit update + Unit* caster = NULL; if (IsSingleTargetSpell(AurSpellInfo)) { @@ -4615,22 +4620,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order) if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) { - m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second); - if((*i).second->GetSpellProto()->AuraInterruptFlags) + m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur); + + if(Aur->GetSpellProto()->AuraInterruptFlags) { - m_interruptableAuras.remove((*i).second); + m_interruptableAuras.remove(Aur); UpdateInterruptMask(); } - if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) - m_ccAuras.remove((*i).second); + + if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) + m_ccAuras.remove(Aur); } // Set remove mode Aur->SetRemoveMode(mode); - // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura - // remove aura from list before to prevent deleting it before - m_Auras.erase(i); - ++m_removedAuras; // internal count used by unit update // Statue unsummoned at aura remove Totem* statue = NULL; @@ -4651,12 +4654,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id)) { - for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) + for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) { if(spell_triggered < 0) - RemoveAurasDueToSpell(-(*i)); + RemoveAurasDueToSpell(-(*itr)); else if(Unit* caster = Aur->GetCaster()) - CastSpell(this, *i, true, 0, 0, caster->GetGUID()); + CastSpell(this, *itr, true, 0, 0, caster->GetGUID()); } } |