diff options
| author | pete318 <pete318@hotmail.com> | 2015-10-14 18:34:44 +0200 |
|---|---|---|
| committer | pete318 <pete318@hotmail.com> | 2015-10-14 18:38:13 +0200 |
| commit | c9258d436bf2a041ad71c3d7ed068848310365c8 (patch) | |
| tree | b16b01b37def7905ea2795217312a273b563948d /src | |
| parent | bfa521491b305f0856c1843dd0e9a7957526b7d6 (diff) | |
Core/Auras: Fixed auras limited to a single target not being removed in all cases as expected
* Fixes possible assertion failure in Aura::UnregisterSingleTarget
Closes #15696
Ref #15668
Cherry picked (manually) from b808910a89822f741d35d4b90e6c4bcf101cd9ef
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f085bab165a..9ced65b56c7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3908,20 +3908,27 @@ void Unit::RemoveAurasWithAttribute(uint32 flags) void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase) { // single target auras from other casters - for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) + // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras). + // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras. + // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container + // leading to assertion failures if the aura was cast on a player that can + // (and is changing map at the point where this function is called). + // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason. + // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance + // to register in m_appliedAuras + for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) { - AuraApplication const* aurApp = iter->second; - Aura const* aura = aurApp->GetBase(); + Aura const* aura = iter->second; - if (aura->GetCasterGUID() != GetGUID() && aura->GetSpellInfo()->IsSingleTarget()) + if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget()) { if (!newPhase) - RemoveAura(iter); + RemoveOwnedAura(iter); else { Unit* caster = aura->GetCaster(); if (!caster || !caster->InSamePhase(newPhase)) - RemoveAura(iter); + RemoveOwnedAura(iter); else ++iter; } |
