Planeshift
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>

Public Member Functions

 EventManager ()
 
csTicks ProcessEventQueue ()
 Check Event Queue for scheduled events which are due. More...
 
void Push (psGameEvent *event)
 Add new event to scheduler queue. More...
 
virtual void Run ()
 
virtual void SendMessageDelayed (MsgEntry *msg, csTicks msecDelay)
 Allows sending of a message not immediately, but after a short delay. More...
 
void Stop ()
 
virtual ~EventManager ()
 
- Public Member Functions inherited from MsgHandler
void AddToLocalQueue (MsgEntry *me)
 
virtual void Broadcast (MsgEntry *msg, broadcasttype scope=NetBase::BC_EVERYONEBUTSELF, int guildID=-1)
 Send messages to many clients with one func call. More...
 
bool Flush ()
 Flush the connected output queue. More...
 
csTicks GetPing ()
 
bool Initialize (NetBase *nb, int queuelen=500)
 Initializes the Handler. More...
 
 MsgHandler ()
 
virtual void Multicast (MsgEntry *msg, csArray< PublishDestination > &multi, uint32_t except, float range)
 Sends the given message me to all the clients in the list. More...
 
void Publish (MsgEntry *msg)
 Distribute message to all subscribers. More...
 
virtual void SendMessage (MsgEntry *msg)
 Allows subscribers to respond with new messages. More...
 
virtual void Subscribe (iNetSubscriber *subscriber, msgtype type, uint32_t flags=0x01)
 Subscribes an iNetSubscriber to a specific message type. More...
 
virtual bool Unsubscribe (iNetSubscriber *subscriber, msgtype type)
 Unsubscribes a subscriber from a specific message type. More...
 
virtual bool UnsubscribeAll (iNetSubscriber *subscriber)
 Searches all message types and deletes any Subscription that has the specified subscriber. More...
 
virtual ~MsgHandler ()
 
- Public Member Functions inherited from Singleton< EventManager >
 Singleton (EventManager *ptr)
 
 Singleton (void)
 
 ~Singleton ()
 

Protected Member Functions

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

Protected Attributes

Heap< psGameEventeventqueue
 
csTicks lastTick
 
CS::Threading::Mutex mutex
 
bool stop
 A flag indicating the server is shutting down. More...
 
- Protected Attributes inherited from MsgHandler
CS::Threading::ReadWriteMutex mutex
 Protects subscribers. More...
 
NetBasenetbase
 
MsgQueuequeue
 
csHash< Subscription, msgtypesubscribers
 Stores the hash of all subscribers and the message type they are subscribed to. More...
 

Additional Inherited Members

- Public Types inherited from MsgHandler
typedef NetBase::broadcasttype broadcasttype
 import the broadcasttype More...
 
- Static Public Member Functions inherited from Singleton< EventManager >
static EventManagerGetSingleton (void)
 
static EventManagerGetSingletonPtr (void)
 

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

Heap<psGameEvent> EventManager::eventqueue
protected

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

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: