Fixed a compiler warning in script.cpp (#4586)

Fixes #4582

Thanks to @idk-whoami and @aleos89
This commit is contained in:
Lemongrass3110
2020-02-03 14:44:58 +01:00
committed by GitHub
parent a323474433
commit b86926a7a2
3 changed files with 10 additions and 10 deletions

View File

@@ -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;
}
/**

View File

@@ -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)

View File

@@ -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