summaryrefslogtreecommitdiff
path: root/src/common/timer.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-09-25 08:50:52 -0300
committershennetsind <ind@henn.et>2013-09-25 08:50:52 -0300
commit1114eb3da58b078258a824424fef687a1ccee90c (patch)
tree1b9c3e4ef48021ce89b331bba2d49061bd08f341 /src/common/timer.c
parent78c7c6bf04a6c96d92524ae37ad165e65f599eb8 (diff)
downloadhercules-1114eb3da58b078258a824424fef687a1ccee90c.tar.gz
hercules-1114eb3da58b078258a824424fef687a1ccee90c.tar.bz2
hercules-1114eb3da58b078258a824424fef687a1ccee90c.tar.xz
hercules-1114eb3da58b078258a824424fef687a1ccee90c.zip
Renamed iTimer interface to timer.
Also removed duplicate mentions of timer within calls to shorten.
Diffstat (limited to 'src/common/timer.c')
-rw-r--r--src/common/timer.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/common/timer.c b/src/common/timer.c
index f019c6927..a2378a5aa 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -21,6 +21,8 @@
#include <sys/time.h> // struct timeval, gettimeofday()
#endif
+struct timer_interface timer_s;
+
// If the server can't handle processing thousands of monsters
// or many connected clients, please increase TIMER_MIN_INTERVAL.
#define TIMER_MIN_INTERVAL 50
@@ -257,7 +259,7 @@ int timer_add_interval(unsigned int tick, TimerFunc func, int id, intptr_t data,
int tid;
if( interval < 1 ) {
- ShowError("timer_add_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, iTimer->gettick()));
+ ShowError("timer_add_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, timer->gettick()));
return INVALID_TIMER;
}
@@ -300,7 +302,7 @@ int timer_do_delete(int tid, TimerFunc func) {
/// Adjusts a timer's expiration time.
/// Returns the new tick value, or -1 if it fails.
int timer_addtick(int tid, unsigned int tick) {
- return iTimer->settick_timer(tid, timer_data[tid].tick+tick);
+ return timer->settick(tid, timer_data[tid].tick+tick);
}
/// Modifies a timer's expiration time (an alternative to deleting a timer and starting a new one).
@@ -415,20 +417,20 @@ void timer_final(void) {
* created by Susu
*-------------------------------------*/
void timer_defaults(void) {
- iTimer = &iTimer_s;
+ timer = &timer_s;
/* funcs */
- iTimer->gettick = timer_gettick;
- iTimer->gettick_nocache = timer_gettick_nocache;
- iTimer->add_timer = timer_add;
- iTimer->add_timer_interval = timer_add_interval;
- iTimer->add_timer_func_list = timer_add_func_list;
- iTimer->get_timer = timer_get;
- iTimer->delete_timer = timer_do_delete;
- iTimer->addtick_timer = timer_addtick;
- iTimer->settick_timer = timer_settick;
- iTimer->get_uptime = timer_get_uptime;
- iTimer->do_timer = do_timer;
- iTimer->init = timer_init;
- iTimer->final = timer_final;
+ timer->gettick = timer_gettick;
+ timer->gettick_nocache = timer_gettick_nocache;
+ timer->add = timer_add;
+ timer->add_interval = timer_add_interval;
+ timer->add_func_list = timer_add_func_list;
+ timer->get = timer_get;
+ timer->delete = timer_do_delete;
+ timer->addtick = timer_addtick;
+ timer->settick = timer_settick;
+ timer->get_uptime = timer_get_uptime;
+ timer->do_timer = do_timer;
+ timer->init = timer_init;
+ timer->final = timer_final;
}