Changeset 3196

Show
Ignore:
Timestamp:
03/03/2010 03:29:30 PM (6 months ago)
Author:
Vlack
Message:

MODIFIED: Reverted "Unit.cpp change on aura event addition" from rev. 3095

This was necessary because if a player renewed an aura that had a duration (like the mage spell Ice Armor, or Arcane Intellect, just to mention a few) and it was still active, the event manager erroneously removed the new aura after the original remaining time ran out.
This happened because it couldn't update the remaining time with the following line of code:
sEventMgr.ModifyEventTimeLeft?(m_auras[x], EVENT_AURA_REMOVE, aur->GetDuration?());
Why?
Because the new code added the event like this:
sEventMgr.AddEvent?( this, &Unit::EventRemoveAura?, aur->GetSpellId?(), EVENT_AURA_REMOVE, aur->GetDuration?() + 500, 1, ...
So after this, the event lived in the Unit's event manager, not in the Aura's, thus the ModifyEventTimeLeft? above couldn't find it inside the aura's event manager (because it wasn't there in the first place).

If this revert introduces any crashes, please notify me on the forum via a PM, so far it looked good...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/arcemu-world/Unit.cpp

    r3189 r3196  
    47234723        if( aur->GetDuration() > 0 ) 
    47244724        { 
    4725         sEventMgr.AddEvent( this, &Unit::EventRemoveAura, aur->GetSpellId(), EVENT_AURA_REMOVE, aur->GetDuration() + 500, 1, 
     4725        sEventMgr.AddEvent(aur, &Aura::Remove, EVENT_AURA_REMOVE, aur->GetDuration() + 500, 1, 
    47264726            EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT | EVENT_FLAG_DELETES_OBJECT ); 
    47274727        }