|
Crossfire Server, Branch 1.12
R12190
|
This handles custom timers. More...

Go to the source code of this file.
Functions | |
| int | cftimer_create (int id, long delay, object *ob, int mode) |
| Creates a new timer. | |
| int | cftimer_destroy (int id) |
| Destroys an existing timer. | |
| int | cftimer_find_free_id (void) |
| Finds a free ID for a new timer. | |
| void | cftimer_init (void) |
| Initialize timers. | |
| static void | cftimer_process_event (tag_t ob_tag) |
| Triggers the EVENT_TIMER of the given object. | |
| void | cftimer_process_timers (void) |
| Processes all timers. | |
Variables | |
| cftimer | timers_table [MAX_TIMERS] |
| The actual timers. | |
| int cftimer_create | ( | int | id, |
| long | delay, | ||
| object * | ob, | ||
| int | mode | ||
| ) |
Creates a new timer.
| id | desired timer identifier. |
| delay | desired timer delay. |
| ob | object that will be linked to this timer. Should have an EVENT_TIMER handler. |
| mode | unit for delay, should be TIMER_MODE_SECONDS or TIMER_MODE_CYCLES. See timers.h. |
| TIMER_ERR_NONE | timer was successfully created. |
| TIMER_ERR_ID | invalid ID. |
| TIMER_ERR_MODE | invalid mode. |
| TIMER_ERR_OBJ | ob is NULL or has no EVENT_TIMER handler. |
Definition at line 106 of file timers.c.
References _cftimer::delay, EVENT_CONNECTOR, EVENT_TIMER, find_obj_by_type_subtype(), MAX_TIMERS, _cftimer::mode, _cftimer::ob_tag, seconds(), TIMER_ERR_ID, TIMER_ERR_MODE, TIMER_ERR_NONE, TIMER_ERR_OBJ, TIMER_MODE_CYCLES, TIMER_MODE_DEAD, and TIMER_MODE_SECONDS.
Referenced by cfapi_timer_create().


| int cftimer_destroy | ( | int | id | ) |
Destroys an existing timer.
| id | identifier of the timer to destroy. |
| TIMER_ERR_NONE | no problem encountered. |
| TIMER_ERR_ID | unknown id - timer not found or invalid. |
Definition at line 137 of file timers.c.
References MAX_TIMERS, _cftimer::mode, TIMER_ERR_ID, TIMER_ERR_NONE, and TIMER_MODE_DEAD.
Referenced by cfapi_timer_destroy().

| int cftimer_find_free_id | ( | void | ) |
Finds a free ID for a new timer.
| TIMER_ERR_ID | no free ID available. |
| >0 | an available ID. |
Definition at line 153 of file timers.c.
References MAX_TIMERS, TIMER_ERR_ID, and TIMER_MODE_DEAD.
Referenced by cfapi_timer_create().

| void cftimer_init | ( | void | ) |
Initialize timers.
Definition at line 166 of file timers.c.
References MAX_TIMERS.
Referenced by init().

| static void cftimer_process_event | ( | tag_t | ob_tag | ) | [static] |
Triggers the EVENT_TIMER of the given object.
| ob_tag | object tag to use. |
Definition at line 80 of file timers.c.
References EVENT_TIMER, execute_event(), find_object(), and SCRIPT_FIX_ALL.
Referenced by cftimer_process_timers().


| void cftimer_process_timers | ( | void | ) |
Processes all timers.
Definition at line 53 of file timers.c.
References cftimer_process_event(), _cftimer::delay, MAX_TIMERS, _cftimer::mode, seconds(), TIMER_MODE_CYCLES, TIMER_MODE_DEAD, and TIMER_MODE_SECONDS.
Referenced by server_main().


1.7.6.1