From 44c33fda3614d588e6bf6cee1cf884e98f1531f0 Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 11 Oct 2013 05:07:45 +0200 Subject: Changed 'tick' variables to 64 bit - This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru --- src/map/pet.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/map/pet.h') diff --git a/src/map/pet.h b/src/map/pet.h index 2f8e0b7c2..f95e860a2 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -86,7 +86,7 @@ struct pet_data { unsigned skillbonus : 1; } state; int move_fail_count; - unsigned int next_walktime,last_thinktime; + int64 next_walktime, last_thinktime; short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] struct pet_recovery* recovery; @@ -116,7 +116,7 @@ struct pet_interface { int (*attackskill) (struct pet_data *pd, int target_id); int (*target_check) (struct map_session_data *sd, struct block_list *bl, int type); int (*sc_check) (struct map_session_data *sd, int type); - int (*hungry) (int tid, unsigned int tick, int id, intptr_t data); + int (*hungry) (int tid, int64 tick, int id, intptr_t data); int (*search_petDB_index) (int key, int type); int (*hungry_timer_delete) (struct pet_data *pd); int (*performance) (struct map_session_data *sd, struct pet_data *pd); @@ -135,16 +135,16 @@ struct pet_interface { int (*change_name) (struct map_session_data *sd, char *name); int (*change_name_ack) (struct map_session_data *sd, char *name, int flag); int (*equipitem) (struct map_session_data *sd, int index); - int (*randomwalk) (struct pet_data *pd, unsigned int tick); - int (*ai_sub_hard) (struct pet_data *pd, struct map_session_data *sd, unsigned int tick); + int (*randomwalk) (struct pet_data *pd, int64 tick); + int (*ai_sub_hard) (struct pet_data *pd, struct map_session_data *sd, int64 tick); int (*ai_sub_foreachclient) (struct map_session_data *sd, va_list ap); - int (*ai_hard) (int tid, unsigned int tick, int id, intptr_t data); - int (*delay_item_drop) (int tid, unsigned int tick, int id, intptr_t data); + int (*ai_hard) (int tid, int64 tick, int id, intptr_t data); + int (*delay_item_drop) (int tid, int64 tick, int id, intptr_t data); int (*lootitem_drop) (struct pet_data *pd, struct map_session_data *sd); - int (*skill_bonus_timer) (int tid, unsigned int tick, int id, intptr_t data); - int (*recovery_timer) (int tid, unsigned int tick, int id, intptr_t data); - int (*heal_timer) (int tid, unsigned int tick, int id, intptr_t data); - int (*skill_support_timer) (int tid, unsigned int tick, int id, intptr_t data); + int (*skill_bonus_timer) (int tid, int64 tick, int id, intptr_t data); + int (*recovery_timer) (int tid, int64 tick, int id, intptr_t data); + int (*heal_timer) (int tid, int64 tick, int id, intptr_t data); + int (*skill_support_timer) (int tid, int64 tick, int id, intptr_t data); int (*read_db) (); }; -- cgit v1.2.3-70-g09d2