From b86926a7a29d20f0c2b500bf75ceaf899eb87eee Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Mon, 3 Feb 2020 14:44:58 +0100 Subject: [PATCH] Fixed a compiler warning in script.cpp (#4586) Fixes #4582 Thanks to @idk-whoami and @aleos89 --- src/map/pc.cpp | 14 +++++++------- src/map/pc.hpp | 4 ++-- src/map/script.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 033168fa7a..f7677166ae 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -9611,7 +9611,7 @@ char* pc_readregistry_str(struct map_session_data *sd, int64 reg) * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/ -int pc_setregistry(struct map_session_data *sd, int64 reg, int64 val) +bool pc_setregistry(struct map_session_data *sd, int64 reg, int64 val) { struct script_reg_num *p = NULL; const char *regname = get_str(script_getvarid(reg)); @@ -9619,7 +9619,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int64 val) if ( !reg_load && !sd->vars_ok ) { ShowError("pc_setregistry : refusing to set %s until vars are received.\n", regname); - return 0; + return false; } if ((p = (struct script_reg_num *)i64db_get(sd->regs.vars, reg))) { @@ -9655,7 +9655,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int64 val) if (!reg_load && p) sd->vars_dirty = true; - return 1; + return true; } /** @@ -9664,7 +9664,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int64 val) * - '#type$' (permanent str account reg) * - '##type$' (permanent str account reg2) **/ -int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) +bool pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) { struct script_reg_str *p = NULL; const char *regname = get_str(script_getvarid(reg)); @@ -9673,13 +9673,13 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) if (!reg_load && !sd->vars_ok) { ShowError("pc_setregistry_str : refusing to set %s until vars are received.\n", regname); - return 0; + return false; } if ( !script_check_RegistryVariableLength(1, val, &vlen ) ) { ShowError("pc_check_RegistryVariableLength: Variable value length is too long (aid: %d, cid: %d): '%s' sz=%zu\n", sd->status.account_id, sd->status.char_id, val, vlen); - return 0; + return false; } if( (p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg) ) ) { @@ -9722,7 +9722,7 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) if( !reg_load && p ) sd->vars_dirty = true; - return 1; + return true; } /** diff --git a/src/map/pc.hpp b/src/map/pc.hpp index 2c6e2d138a..fca4847019 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -1189,9 +1189,9 @@ bool pc_setreg(struct map_session_data *sd, int64 reg, int64 val); char *pc_readregstr(struct map_session_data *sd, int64 reg); bool pc_setregstr(struct map_session_data *sd, int64 reg, const char *str); int64 pc_readregistry(struct map_session_data *sd, int64 reg); -int pc_setregistry(struct map_session_data *sd, int64 reg, int64 val); +bool pc_setregistry(struct map_session_data *sd, int64 reg, int64 val); char *pc_readregistry_str(struct map_session_data *sd, int64 reg); -int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val); +bool pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val); #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg) #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val) diff --git a/src/map/script.cpp b/src/map/script.cpp index 6ef7bb2937..47234c4f3e 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -1692,7 +1692,7 @@ const char* parse_syntax(const char* p) p = skip_space(p); if(*p != ':') disp_error_message("parse_syntax: expect ':'",p); - sprintf(label,"if(%lld != $@__SW%x_VAL) goto __SW%x_%x;", + sprintf(label,"if(%" PRId64 " != $@__SW%x_VAL) goto __SW%x_%x;", v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1); syntax.curly[syntax.curly_count++].type = TYPE_NULL; // Bad I do not parse twice