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. | |
const char * | GetType () |
Return the type that this event where created with. | |
virtual bool | IsValid () |
Return the valid flag. | |
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. | |
void | QueueEvent () |
Publish the game event to the local program. | |
virtual void | SetValid (bool valid) |
Set the valid flag. | |
virtual csString | ToString () const |
Return a string with information about the event. | |
virtual void | Trigger ()=0 |
Abstract event processing function. | |
virtual | ~psGameEvent () |
Public Attributes | |
csTicks | delayticks |
delay before the event starts | |
int | id |
id value combined with ticks ensures uniqueness for tree | |
csTicks | triggerticks |
ticks value when event should be triggered. | |
bool | valid |
Set this to false if the trigger should not be fired. | |
Static Public Attributes | |
static EventManager * | eventmanager |
static int | nextid |
id counter sequence |
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 psGameEvent::~psGameEvent | ( | ) | [virtual] |
virtual bool psGameEvent::CheckTrigger | ( | ) | [inline, virtual] |
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.
const char* psGameEvent::GetType | ( | ) | [inline] |
Return the type that this event where created with.
Used for debugging.
Reimplemented in psWeatherGameEvent.
Definition at line 109 of file gameevent.h.
virtual bool psGameEvent::IsValid | ( | ) | [inline, virtual] |
Return the valid flag.
Reimplemented in psActionTimeoutGameEvent.
Definition at line 100 of file gameevent.h.
bool psGameEvent::operator< | ( | const psGameEvent & | other | ) | const [inline] |
Definition at line 133 of file gameevent.h.
bool psGameEvent::operator== | ( | const psGameEvent & | other | ) | const [inline] |
Definition at line 127 of file gameevent.h.
bool psGameEvent::operator> | ( | const psGameEvent & | other | ) | const [inline] |
Definition at line 143 of file gameevent.h.
void psGameEvent::QueueEvent | ( | ) |
Publish the game event to the local program.
virtual void psGameEvent::SetValid | ( | bool | valid | ) | [inline, virtual] |
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.
virtual csString psGameEvent::ToString | ( | ) | const [inline, virtual] |
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 psServerConsoleCommand, psNPCTick, and PerceptOperation::DelayedPerceptOperationGameEvent.
Definition at line 122 of file gameevent.h.
virtual void psGameEvent::Trigger | ( | ) | [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 psServerConsoleCommand, psNPCReconnect, psNPCTick, PerceptOperation::DelayedPerceptOperationGameEvent, psActionTimeoutGameEvent, psAdviceSessionTimeoutGameEvent, psAdviceRequestTimeoutGameEvent, psMoneyGameEvent, psCombatAttackGameEvent, psSaveCharEvent, psSpellCastGameEvent, CacheManager::psCacheExpireEvent, psEndChatLoggingEvent, psSpareDefeatedEvent, psEconomyDrop, psEntityEvent, psResurrectEvent, psEndSongEvent, psRespawnGameEvent, psDespawnGameEvent, psItemSpawnEvent, psWeatherGameEvent, and psWorkGameEvent.
csTicks psGameEvent::delayticks |
delay before the event starts
Definition at line 43 of file gameevent.h.
EventManager* psGameEvent::eventmanager [static] |
Definition at line 40 of file gameevent.h.
id value combined with ticks ensures uniqueness for tree
Definition at line 44 of file gameevent.h.
int psGameEvent::nextid [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.
Reimplemented in psActionTimeoutGameEvent, and CacheManager::psCacheExpireEvent.
Definition at line 46 of file gameevent.h.