diff options
author | QAston <none@none> | 2010-01-29 18:51:06 +0100 |
---|---|---|
committer | QAston <none@none> | 2010-01-29 18:51:06 +0100 |
commit | 94e5e3970e93fd8726e58697722a1a814211adf0 (patch) | |
tree | 2c1d5dbc6e37775fca251769fbdcc2c7784101b1 /src | |
parent | 04aff1dba8488525d4eecb9ccc4b3aadc95b8976 (diff) |
*Prevent linked effects to apply area auras in Unit::RemoveAreaAurasDueToLeaveWorld, finally fix the update sql
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Unit.cpp | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d9c1179823c..bb48d49ab7b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4300,33 +4300,43 @@ void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemo void Unit::RemoveAreaAurasDueToLeaveWorld() { - // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later - for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) + bool cleanRun; + do { - Aura * aura = iter->second; - ++iter; - Aura::ApplicationMap const & appMap = aura->GetApplicationMap(); - for(Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr!= appMap.end();) + cleanRun = true; + // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later + for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) { - AuraApplication * aurApp = itr->second; - ++itr; - Unit * target = aurApp->GetTarget(); - if (target == this) - continue; - target->RemoveAura(aurApp); - // things linked on aura remove may apply new area aura - so start from the beginning - iter = m_ownedAuras.begin(); + Aura * aura = iter->second; + ++iter; + Aura::ApplicationMap const & appMap = aura->GetApplicationMap(); + for(Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr!= appMap.end();) + { + AuraApplication * aurApp = itr->second; + ++itr; + Unit * target = aurApp->GetTarget(); + if (target == this) + continue; + target->RemoveAura(aurApp); + cleanRun = false; + // things linked on aura remove may apply new area aura - so start from the beginning + iter = m_ownedAuras.begin(); + } } - } - // remove area auras owned by others - for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) - { - if (iter->second->GetBase()->GetOwner()!=this) - RemoveAura(iter); - else - ++iter; + // remove area auras owned by others + for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) + { + if (iter->second->GetBase()->GetOwner()!=this) + { + RemoveAura(iter); + cleanRun = false; + } + else + ++iter; + } } + while (!cleanRun); } void Unit::RemoveAllAuras() |