summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.c10
-rw-r--r--src/common/mmo.h10
-rw-r--r--src/map/chrif.c5
-rw-r--r--src/map/status.c5
4 files changed, 18 insertions, 12 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);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 981c1b30b..91eccb8cd 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -220,6 +220,8 @@
#define SCRIPT_VARNAME_LENGTH 32 ///< Maximum length of a script variable
+#define INFINITE_DURATION (-1) // Infinite duration for status changes
+
struct hplugin_data_store;
enum item_types {
@@ -392,11 +394,11 @@ struct script_reg_str {
char *value;
};
-// For saving status changes across sessions. [Skotlex]
+/// For saving status changes across sessions. [Skotlex]
struct status_change_data {
- unsigned short type; //SC_type
- int val1, val2, val3, val4;
- unsigned int tick; //Remaining duration.
+ unsigned short type; ///< Status change type (@see enum sc_type)
+ int val1, val2, val3, val4; ///< Parameters (meaning depends on type).
+ int tick; ///< Remaining duration.
};
struct storage_data {
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: