diff options
| author | megamage <none@none> | 2009-05-06 10:02:40 -0500 | 
|---|---|---|
| committer | megamage <none@none> | 2009-05-06 10:02:40 -0500 | 
| commit | 54c514eee570d97756ac300938c968291d89e0f0 (patch) | |
| tree | 0a57f5740de735dee911d33a9ee435697a63efd0 /src/game/Unit.cpp | |
| parent | 9bbde48afbe5568f75df24ea0b0aad3d8660c54b (diff) | |
*Backport a crash fix from TC2. Fix a crash caused by stealing single target aura. Source: Mangos.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 23 | 
1 files changed, 6 insertions, 17 deletions
| diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6c4e171e4f1..cac26755d3f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3822,7 +3822,7 @@ bool Unit::AddAura(Aura *Aur)      }      // update single target auras list (before aura add to aura list, to prevent unexpected remove recently added aura) -    if (IsSingleTargetSpell(aurSpellInfo) && Aur->GetTarget()) +    if (Aur->IsSingleTarget() && Aur->GetTarget())      {          // caster pointer can be deleted in time aura remove, find it by guid at each iteration          for(;;) @@ -4160,9 +4160,12 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit              new_aur->SetAuraMaxDuration( max_dur > dur ? dur : max_dur );              new_aur->SetAuraDuration( max_dur > dur ? dur : max_dur ); +            // Unregister _before_ adding to stealer +            aur->UnregisterSingleCastAura(); +            // strange but intended behaviour: Stolen single target auras won't be treated as single targeted +            new_aur->SetIsSingleTarget(false);              // add the new aura to stealer              stealer->AddAura(new_aur); -              // Remove aura as dispel              RemoveAura(iter, AURA_REMOVE_BY_DISPEL);          } @@ -4309,20 +4312,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)      ++m_removedAuras;                                       // internal count used by unit update      Unit* caster = NULL; -    if (IsSingleTargetSpell(AurSpellInfo)) -    { -        caster = Aur->GetCaster(); -        if(caster) -        { -            AuraList& scAuras = caster->GetSingleCastAuras(); -            scAuras.remove(Aur); -        } -        else -        { -            sLog.outError("Couldn't find the caster of the single target aura, may crash later!"); -            assert(false); -        } -    } +    Aur->UnregisterSingleCastAura();      // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)      if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) @@ -13087,4 +13077,3 @@ void Unit::AddAura(uint32 spellId, Unit* target)          }      }  } - | 
