summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-27 05:20:40 +0100
committerHaru <haru@dotalux.com>2016-02-27 14:30:02 +0100
commit33d37ff161f724b0bbcde4eedf32c528d3576c90 (patch)
tree9dad669d1085a95344ece61161ca87e2a5cf7aa5 /src/char/char.c
parent8748ee58a47d8b1c6c88ebb1e18806921d37b746 (diff)
downloadhercules-33d37ff161f724b0bbcde4eedf32c528d3576c90.tar.gz
hercules-33d37ff161f724b0bbcde4eedf32c528d3576c90.tar.bz2
hercules-33d37ff161f724b0bbcde4eedf32c528d3576c90.tar.xz
hercules-33d37ff161f724b0bbcde4eedf32c528d3576c90.zip
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 <haru@dotalux.com>
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 6b12faa60..0fe48def3 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3712,7 +3712,7 @@ void char_parse_frommap_save_status_change_data(int fd)
memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
if( i > 0 )
StrBuf->AppendStr(&buf, ", ");
- StrBuf->Printf(&buf, "('%d','%d','%hu','%u','%d','%d','%d','%d')", aid, cid,
+ StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid,
data.type, data.tick, data.val1, data.val2, data.val3, data.val4);
}
if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) )
@@ -3880,9 +3880,11 @@ void char_parse_frommap_scdata_update(int fd)
int val4 = RFIFOL(fd, 24);
short type = RFIFOW(fd, 10);
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`) VALUES ('%d','%d','%d',-1,'%d','%d','%d','%d')",
- scdata_db, account_id, char_id, type, val1, val2, val3, val4) )
- {
+ if (SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`"
+ " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)"
+ " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')",
+ scdata_db, account_id, char_id, type, INFINITE_DURATION, val1, val2, val3, val4)
+ ) {
Sql_ShowDebug(inter->sql_handle);
}
RFIFOSKIP(fd, 28);