Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

EventManager Class Reference

This class handles all queueing and invoking of timed events, such as combat, spells, NPC dialog responses, range weapons, or NPC respawning. More...

#include <eventmanager.h>

List of all members.

Public Member Functions

 EventManager ()
csTicks ProcessEventQueue ()
 Check Event Queue for scheduled events which are due.
void Push (psGameEvent *event)
 Add new event to scheduler queue.
virtual void Run ()
virtual void SendMessageDelayed (MsgEntry *msg, csTicks msecDelay)
 Allows sending of a message not immediately, but after a short delay.
void Stop ()
virtual ~EventManager ()

Protected Member Functions

void TrackEventTimes (csTicks timeTaken, MsgEntry *msg)
 Helper function to keep a running average of the last 50 events.

Protected Attributes

Heap< psGameEventeventqueue
csTicks lastTick
CS::Threading::Mutex mutex
 Protects subscribers.
bool stop
 A flag indicating the server is shutting down.

Detailed Description

This class handles all queueing and invoking of timed events, such as combat, spells, NPC dialog responses, range weapons, or NPC respawning.

It maintains a queue ordered by trigger time and is polled by the engine periodically to clear any queued events with trigger times less than the current ticks time.

Definition at line 40 of file eventmanager.h.


Constructor & Destructor Documentation

EventManager::EventManager ( )
virtual EventManager::~EventManager ( ) [virtual]

Member Function Documentation

csTicks EventManager::ProcessEventQueue ( )

Check Event Queue for scheduled events which are due.

void EventManager::Push ( psGameEvent event)

Add new event to scheduler queue.

virtual void EventManager::Run ( ) [virtual]
virtual void EventManager::SendMessageDelayed ( MsgEntry msg,
csTicks  msecDelay 
) [virtual]

Allows sending of a message not immediately, but after a short delay.

void EventManager::Stop ( ) [inline]

Definition at line 62 of file eventmanager.h.

void EventManager::TrackEventTimes ( csTicks  timeTaken,
MsgEntry msg 
) [protected]

Helper function to keep a running average of the last 50 events.


Member Data Documentation

Definition at line 44 of file eventmanager.h.

csTicks EventManager::lastTick [protected]

Definition at line 46 of file eventmanager.h.

CS::Threading::Mutex EventManager::mutex [protected]

Protects subscribers.

Reimplemented from MsgHandler.

Definition at line 43 of file eventmanager.h.

bool EventManager::stop [protected]

A flag indicating the server is shutting down.

Definition at line 49 of file eventmanager.h.


The documentation for this class was generated from the following file: