[7771] Replace different ways access to aura type in Unit::AddAura by more safe (after call ApplyModifier) local variable.

This commit is contained in:
VladimirMangos 2009-05-05 12:44:40 +04:00
parent eb9bd0ec7e
commit bda5da94c5
2 changed files with 6 additions and 5 deletions

View file

@ -3345,6 +3345,7 @@ bool Unit::AddAura(Aura *Aur)
} }
SpellEntry const* aurSpellInfo = Aur->GetSpellProto(); SpellEntry const* aurSpellInfo = Aur->GetSpellProto();
AuraType aurName = Aur->GetModifier()->m_auraname;
spellEffectPair spair = spellEffectPair(Aur->GetId(), Aur->GetEffIndex()); spellEffectPair spair = spellEffectPair(Aur->GetId(), Aur->GetEffIndex());
AuraMap::iterator i = m_Auras.find( spair ); AuraMap::iterator i = m_Auras.find( spair );
@ -3372,7 +3373,7 @@ bool Unit::AddAura(Aura *Aur)
} }
bool stop = false; bool stop = false;
switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]) switch(aurName)
{ {
// DoT/HoT/etc // DoT/HoT/etc
case SPELL_AURA_PERIODIC_DAMAGE: // allow stack case SPELL_AURA_PERIODIC_DAMAGE: // allow stack
@ -3448,13 +3449,13 @@ bool Unit::AddAura(Aura *Aur)
// add aura, register in lists and arrays // add aura, register in lists and arrays
Aur->_AddAura(); Aur->_AddAura();
m_Auras.insert(AuraMap::value_type(spellEffectPair(Aur->GetId(), Aur->GetEffIndex()), Aur)); m_Auras.insert(AuraMap::value_type(spellEffectPair(Aur->GetId(), Aur->GetEffIndex()), Aur));
if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) if (aurName < TOTAL_AURAS)
{ {
m_modAuras[Aur->GetModifier()->m_auraname].push_back(Aur); m_modAuras[aurName].push_back(Aur);
} }
Aur->ApplyModifier(true,true); Aur->ApplyModifier(true,true);
sLog.outDebug("Aura %u now is in use", Aur->GetModifier()->m_auraname); sLog.outDebug("Aura %u now is in use", aurName);
return true; return true;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7770" #define REVISION_NR "7771"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__