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. | |
void | remove_event (event *evnt) |
Removes the given event from the event handler. | |
void | raise_event (const event *evnt) |
Raise one or more events in case the given time matches their "alarm" time. |
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 36 of file time_event_handler.h.
void time_event_handler::register_event | ( | event * | evnt | ) | [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 69 of file time_event_handler.cc.
void time_event_handler::remove_event | ( | event * | evnt | ) | [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 57 of file time_event_handler.cc.
void time_event_handler::raise_event | ( | const event * | evnt | ) | [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 30 of file time_event_handler.cc.