From 33d37ff161f724b0bbcde4eedf32c528d3576c90 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 27 Feb 2016 05:20:40 +0100 Subject: Corrected wrong variable type of struct status_change_data::tick - The variable should be signed, since it uses the value -1 to indicate infinite duration (and it's stored as signed in the database). - Added #define for the special value -1 (INFINITE_DURATION). - This fixes an issue causing status changes to fail being saved to database (thanks to Michi for reporting it). - Related to commit 8dc75721. Signed-off-by: Haru --- src/map/chrif.c | 5 +++-- src/map/status.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/chrif.c b/src/map/chrif.c index 0f158b645..578942897 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1173,8 +1173,9 @@ bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of th data.tick = DIFF_TICK32(td->tick,tick); //Duration that is left before ending. else data.tick = 0; //Negative tick does not necessarily mean that sc has expired - } else - data.tick = -1; //Infinite duration + } else { + data.tick = INFINITE_DURATION; + } data.type = i; data.val1 = sc->data[i]->val1; data.val2 = sc->data[i]->val2; diff --git a/src/map/status.c b/src/map/status.c index c4c0e39a2..bef808d11 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -12299,8 +12299,9 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { if (td == NULL || td->func != status->change_timer || DIFF_TICK(td->tick,tick) < 0) continue; data.tick = DIFF_TICK32(td->tick,tick); - } else - data.tick = INVALID_TIMER; + } else { + data.tick = INFINITE_DURATION; + } break; // Special cases case SC_POISON: -- cgit v1.2.3-70-g09d2