rathena/src/common/timer.h
Cahyadi Ramadhan Togihon f058c4de1c * Follow up f056629
-- Updated item_db.txt, makes Rebellion can use Gunslinger weapons and ammos
-- Updated item_db.sql and item_db_re.sql
-- 3CeAM 2.0 merger: r13
-- idAthena merger: r1057, r1077
* Follow up 3f6d4b6
-- Update the const.txt for SC_MOONSTAR and SC_SUPER_STAR. SC_EXTREMITYFIST2 should be always on the end of SC number
* Hercules merger: 1375af7d00

Signed-off-by: Cahyadi Ramadhan Togihon <house.bad@gmail.com>
2013-10-28 12:23:23 +07:00

58 lines
1.3 KiB
C

// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _TIMER_H_
#define _TIMER_H_
#include "../common/cbasetypes.h"
#define DIFF_TICK(a,b) ((int)((a)-(b)))
#define INVALID_TIMER -1
#define CLIF_WALK_TIMER -2
// timer flags
enum {
TIMER_ONCE_AUTODEL = 0x01,
TIMER_INTERVAL = 0x02,
TIMER_REMOVE_HEAP = 0x10,
};
// Struct declaration
typedef int (*TimerFunc)(int tid, unsigned int tick, int id, intptr_t data);
struct TimerData {
unsigned int tick;
TimerFunc func;
unsigned int type;
int interval;
// general-purpose storage
int id;
intptr_t data;
};
// Function prototype declaration
unsigned int gettick(void);
unsigned int gettick_nocache(void);
int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data);
int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
const struct TimerData* get_timer(int tid);
int delete_timer(int tid, TimerFunc func);
int addtick_timer(int tid, unsigned int tick);
int settick_timer(int tid, unsigned int tick);
int add_timer_func_list(TimerFunc func, char* name);
unsigned long get_uptime(void);
int do_timer(unsigned int tick);
void timer_init(void);
void timer_final(void);
#endif /* _TIMER_H_ */