aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-17 17:57:15 -0600
committermegamage <none@none>2009-01-17 17:57:15 -0600
commit54ed3974138f2f51c3c42c4469f9f1541818f631 (patch)
treeec47275d8cec63057455b20598285e2f79a72e2d /src/game/Unit.cpp
parent90e4a2b558f954fb6f24dcf70798ae702293bfa2 (diff)
parent9f1409c557c4ef6edc2bb9b54c6ad0463beb20db (diff)
*Update to Trinity 881.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d4c7b1de61f..8d16842145a 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -181,6 +181,9 @@ Unit::~Unit()
RemoveAllDynObjects();
if(m_charmInfo) delete m_charmInfo;
+
+ RemoveAllAuras();
+ assert(m_Auras.begin() == m_Auras.end());
}
void Unit::Update( uint32 p_time )
@@ -3973,18 +3976,7 @@ 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 itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
- {
- if(spell_triggered < 0)
- RemoveAurasDueToSpell(-(*itr));
- else if(Unit* caster = Aur->GetCaster())
- CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
- }
- }
-
- sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
+ sLog.outDebug("Aura %u (%u) now is remove mode %d", Aur->GetId(), Aur->GetModifier()->m_auraname, mode);
assert(!Aur->IsInUse());
Aur->ApplyModifier(false,true);
Aur->_RemoveAura();
@@ -3996,6 +3988,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
if(statue)
statue->UnSummon();
+ if(mode != AURA_REMOVE_BY_STACK)
+ {
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
+ {
+ for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+ {
+ if(spell_triggered < 0)
+ RemoveAurasDueToSpell(-(*itr));
+ else if(Unit* caster = Aur->GetCaster())
+ CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
+ }
+ }
+ }
+
// only way correctly remove all auras from list
if( m_Auras.empty() )
i = m_Auras.end();