Fixed readparam behaviour for variables
Readparam now works correctly with variables. This is a follow up to e112fc1 which addressed #647. Fixes #1213, thanks to @Everade.
This commit is contained in:
parent
55165ac0bf
commit
2b61f45a94
@ -7695,7 +7695,7 @@ BUILDIN_FUNC(disableitemuse)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
BUILDIN_FUNC(readparam)
|
BUILDIN_FUNC(readparam)
|
||||||
{
|
{
|
||||||
int type;
|
int value;
|
||||||
struct script_data *data = script_getdata(st, 2);
|
struct script_data *data = script_getdata(st, 2);
|
||||||
TBL_PC *sd;
|
TBL_PC *sd;
|
||||||
|
|
||||||
@ -7704,14 +7704,15 @@ BUILDIN_FUNC(readparam)
|
|||||||
return SCRIPT_CMD_FAILURE;
|
return SCRIPT_CMD_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->type == C_NAME) { // If using constant name, just get the val
|
// If you use a parameter, return the value behind it
|
||||||
|
if( reference_toparam(data) ){
|
||||||
get_val_(st, data, sd);
|
get_val_(st, data, sd);
|
||||||
script_pushint(st, (int)data->u.num);
|
value = (int)data->u.num;
|
||||||
return SCRIPT_CMD_SUCCESS;
|
}else{
|
||||||
|
value = pc_readparam(sd,script_getnum(st, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
type = script_getnum(st, 2);
|
script_pushint(st,value);
|
||||||
script_pushint(st,pc_readparam(sd,type));
|
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user