diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index e4cf7f227..b432e6720 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4,7 +4,7 @@ #define HERCULES_CORE -#include "../config/core.h" // NEW_CARTS, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT, SECURE_NPCTIMEOUT_INTERVAL +#include "../config/core.h" // RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT, SECURE_NPCTIMEOUT_INTERVAL #include "script.h" #include <math.h> @@ -45,6 +45,7 @@ #include "../common/cbasetypes.h" #include "../common/malloc.h" #include "../common/md5calc.h" +#include "../common/mmo.h" // NEW_CARTS #include "../common/nullpo.h" #include "../common/random.h" #include "../common/showmsg.h" @@ -2914,6 +2915,8 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co return pc_setglobalreg_str(sd, num, str); } } else {// integer variable + // FIXME: This isn't safe, in 32bits systems we're converting a 64bit pointer + // to a 32bit int, this will lead to overflows! [Panikon] int val = (int)__64BPTRSIZE(value); if(script->str_data[script_getvarid(num)].type == C_PARAM) { @@ -2921,7 +2924,11 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co if( st != NULL ) { ShowError("script:set_reg: failed to set param '%s' to %d.\n", name, val); script->reportsrc(st); - st->state = END; + // Instead of just stop the script execution we let the character close + // the window if it was open. + st->state = (sd->state.dialog) ? CLOSE : END; + if( st->state == CLOSE ) + clif->scriptclose(sd, st->oid); } return 0; } |