aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaelima <kaelima@live.se>2012-01-06 18:26:19 -0800
committerKaelima <kaelima@live.se>2012-01-06 18:26:19 -0800
commit70d51e53c3be977ad2714315a338179cb423ef1c (patch)
treece99ef7b7ff7632f566cb5e601c7088f5afb3e0f /src
parent09b5902e41454302e3146abbef4ae93e341141e7 (diff)
parent7f977c28b64848c9fd10df76a09edb87781b6b1d (diff)
Merge pull request #4684 from Subv/fix1
Fixed the behaviour of SmartAI::RemoveAuras
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index b5fdf38a4b6..09d70204a7b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -433,24 +433,13 @@ 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();)
+ for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter)
{
Aura const* aura = iter->second->GetBase();
- if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !(iter->second->GetTarget() == me && aura->GetCaster() == me))
- me->_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
- else
- ++iter;
- }
-
- Unit::AuraMap ownedAuras = me->GetOwnedAuras();
- for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();)
- {
- Aura* aura = iter->second;
- if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE))
- me->RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
- else
- ++iter;
+ if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCaster() != me)
+ me->RemoveAurasDueToSpell(aura->GetId());
}
}