diff options
author | Shauren <shauren.trinity@gmail.com> | 2013-02-09 17:57:27 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2013-02-09 17:57:27 +0100 |
commit | 985de41421f33178cffd2247ab14369334e801ee (patch) | |
tree | fb49ac42b1cca1a6355c8b06174e2a218b0d4ccd /src | |
parent | a7eef6a598d0db01d12cd6f3703b302fea2d9cbb (diff) |
Core/SAI: Rewrite SmartAI::RemoveAuras in a safer way
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index e568a36abc4..501bc35b77a 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -430,13 +430,14 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) void SmartAI::RemoveAuras() { - // Only loop throught the applied auras, because here is where all auras on the current unit are stored - Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras(); - for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter) + Unit::AuraApplicationMap& appliedAuras = me->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();) { Aura const* aura = iter->second->GetBase(); - if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCaster() != me) - me->RemoveAurasDueToSpell(aura->GetId()); + if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCasterGUID() != me->GetGUID()) + me->RemoveAura(iter); + else + ++iter; } } |