Adonthell
0.4
|
This class keeps track of time events, i.e. More...
#include <time_event_handler.h>
Public Member Functions | |
void | register_event (event *evnt) |
Register a time event with the event handler. More... | |
void | remove_event (event *evnt) |
Removes the given event from the event handler. More... | |
void | raise_event (const event *evnt) |
Raise one or more events in case the given time matches their "alarm" time. More... | |
![]() | |
virtual | ~event_handler_base () |
Destructor. More... | |
This class keeps track of time events, i.e.
events that are raised at a certain point in (game) time. All registered events are sorted by the time they need to be raised, so that only one comparison decides upon whether an event is to be raised.
Definition at line 40 of file time_event_handler.h.
|
virtual |
Register a time event with the event handler.
It is inserted into the vector of registered events depending on its "alarm" time. The event needs to be removed before it can be safely deleted.
evnt | Pointer to the event to be registered. |
Implements event_handler_base.
Definition at line 73 of file time_event_handler.cc.
|
virtual |
Removes the given event from the event handler.
Once it is no longer needed, it can be freed.
evnt | Pointer to the event to be removed. |
Implements event_handler_base.
Definition at line 61 of file time_event_handler.cc.
|
virtual |
Raise one or more events in case the given time matches their "alarm" time.
When they need to be repeated, they are re-inserted into the event-vector.
evnt | An event structure with the current game time in minutes. |
Implements event_handler_base.
Definition at line 34 of file time_event_handler.cc.