Planeshift
|
All scheduled events must inherit from this class. More...
#include <gameevent.h>
Public Member Functions | |
virtual bool | CheckTrigger () |
Called right before a Trigger is called. More... | |
const char * | GetType () |
Return the type that this event where created with. More... | |
virtual bool | IsValid () |
Return the valid flag. More... | |
bool | operator< (const psGameEvent &other) const |
bool | operator== (const psGameEvent &other) const |
bool | operator> (const psGameEvent &other) const |
psGameEvent (csTicks ticks, int offsetticks, const char *newType) | |
Construct a new game event. More... | |
void | QueueEvent () |
Publish the game event to the local program. More... | |
virtual void | SetValid (bool valid) |
Set the valid flag. More... | |
virtual csString | ToString () const |
Return a string with information about the event. More... | |
virtual void | Trigger ()=0 |
Abstract event processing function. More... | |
virtual | ~psGameEvent () |
Public Attributes | |
csTicks | delayticks |
delay before the event starts More... | |
int | id |
id value combined with ticks ensures uniqueness for tree More... | |
csTicks | triggerticks |
ticks value when event should be triggered. More... | |
bool | valid |
Set this to false if the trigger should not be fired. More... | |
Static Public Attributes | |
static EventManager * | eventmanager |
static int | nextid |
id counter sequence More... | |
All scheduled events must inherit from this class.
These events are queued by the EventManager and are passed to the various subscribed handlers at the appropriate time.
Definition at line 36 of file gameevent.h.
psGameEvent::psGameEvent | ( | csTicks | ticks, |
int | offsetticks, | ||
const char * | newType | ||
) |
Construct a new game event.
Set ticks to 0 if the event should be fired at offset ticks from current time.
|
virtual |
|
inlinevirtual |
Called right before a Trigger is called.
Default implementation use the valid flag to determin if the Trigger should be calle.Could be overridden to allow for other conditions.
This function allows psGEMEvents to disconnect themselves
Reimplemented in psEndSongEvent.
Definition at line 69 of file gameevent.h.
|
inline |
Return the type that this event where created with.
Used for debugging.
Definition at line 109 of file gameevent.h.
|
inlinevirtual |
Return the valid flag.
Reimplemented in psActionTimeoutGameEvent.
Definition at line 100 of file gameevent.h.
|
inline |
Definition at line 133 of file gameevent.h.
|
inline |
Definition at line 127 of file gameevent.h.
|
inline |
Definition at line 143 of file gameevent.h.
void psGameEvent::QueueEvent | ( | ) |
Publish the game event to the local program.
|
inlinevirtual |
Set the valid flag.
Setting of valid to false will if the CheckTrigger isn't overridden cause the Trigger not to be called.
valid | The new value of the valid flag. |
Definition at line 90 of file gameevent.h.
|
inlinevirtual |
Return a string with information about the event.
Used for debugging to be able to identify things like way did this event take so long to execute.
TODO: Make this function abstract. But for now return "".
Reimplemented in PerceptOperation::DelayedPerceptOperationGameEvent, psNPCTick, and psServerConsoleCommand.
Definition at line 122 of file gameevent.h.
|
pure virtual |
Abstract event processing function.
This functino have to be overridden and will be called if CheckTrigger is ok at the time given in the constructor.
Implemented in psResurrectEvent, PerceptOperation::DelayedPerceptOperationGameEvent, psNPCTick, CacheManager::psCacheExpireEvent, psWorkGameEvent, psNPCReconnect, psItemSpawnEvent, psDespawnGameEvent, psRespawnGameEvent, psSaveCharEvent, psSpellCastGameEvent, psEntityEvent, psCombatAttackGameEvent, psAdviceRequestTimeoutGameEvent, psAdviceSessionTimeoutGameEvent, psWeatherGameEvent, psEndChatLoggingEvent, psServerConsoleCommand, psSpareDefeatedEvent, psEconomyDrop, psMoneyGameEvent, psActionTimeoutGameEvent, and psEndSongEvent.
csTicks psGameEvent::delayticks |
delay before the event starts
Definition at line 43 of file gameevent.h.
|
static |
Definition at line 40 of file gameevent.h.
int psGameEvent::id |
id value combined with ticks ensures uniqueness for tree
Definition at line 44 of file gameevent.h.
|
static |
id counter sequence
Definition at line 45 of file gameevent.h.
csTicks psGameEvent::triggerticks |
ticks value when event should be triggered.
Definition at line 42 of file gameevent.h.
bool psGameEvent::valid |
Set this to false if the trigger should not be fired.
Definition at line 46 of file gameevent.h.