Changeset 173 for trunk/src/framework

Show
Ignore:
Timestamp:
11/19/08 13:43:02 (17 years ago)
Author:
yumileroy
Message:

[svn] * Avoid access to bag item prototype for getting bag size, use related item update field instead as more fast source.
* Better check client inventory pos data received in some client packets to skip invalid cases.
* Removed some unnecessary database queries.
* Make guid lookup for adding ignore async.
* Added two parameter versions of the AsyncQuery? function
* Make queries for adding friends async. - Hunuza
* Replace some PQuery() calls with more simple Query() - Hunuza
* Mark spell as executed instead of deleteable to solve crash.
*** Source mangos.

**Its a big commit. so test with care... or without care.... whatever floats your boat.

Original author: KingPin?
Date: 2008-11-05 20:10:19-06:00

Location:
trunk/src/framework/Utilities
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/framework/Utilities/EventProcessor.cpp

    r102 r173  
    2929EventProcessor::~EventProcessor() 
    3030{ 
    31     KillAllEvents(); 
     31    KillAllEvents(true); 
    3232} 
    3333 
     
    6161} 
    6262 
    63 void EventProcessor::KillAllEvents() 
     63void EventProcessor::KillAllEvents(bool force) 
    6464{ 
    6565    // prevent event insertions 
     
    6767 
    6868    // first, abort all existing events 
    69     for (EventList::iterator i = m_events.begin(); i != m_events.end(); ++i) 
     69    for (EventList::iterator i = m_events.begin(); i != m_events.end();) 
    7070    { 
    71         i->second->to_Abort = true; 
    72         i->second->Abort(m_time); 
    73         delete i->second; 
     71        EventList::iterator i_old = i; 
     72        ++i; 
     73         
     74        i_old->second->to_Abort = true; 
     75        i_old->second->Abort(m_time); 
     76        if(force || i_old->second->IsDeletable()) 
     77        { 
     78            delete i_old->second; 
     79             
     80            if(!force)                                      // need per-element cleanup 
     81                m_events.erase (i_old); 
     82        } 
    7483    } 
    7584 
    76     // clear event list 
    77     m_events.clear(); 
     85    // fast clear event list (in force case) 
     86    if(force) 
     87        m_events.clear(); 
    7888} 
    7989 
  • trunk/src/framework/Utilities/EventProcessor.h

    r102 r173  
    4040        // e_time is execution time, p_time is update interval 
    4141        virtual bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) { return true; } 
     42         
     43        virtual bool IsDeletable() const { return true; }   // this event can be safely deleted 
    4244 
    4345        virtual void Abort(uint64 /*e_time*/) {}            // this method executes when the event is aborted 
     
    6062 
    6163        void Update(uint32 p_time); 
    62         void KillAllEvents(); 
     64        void KillAllEvents(bool force); 
    6365        void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true); 
    6466        uint64 CalculateTime(uint64 t_offset);