Follow up 5f21afb2555d73bba219fd9fdb1d117c0e1950b1
Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
This commit is contained in:
parent
3b197eb76c
commit
ee1866152f
@ -170,6 +170,8 @@
|
|||||||
#define SCRIPT_BLOCK_SIZE 512
|
#define SCRIPT_BLOCK_SIZE 512
|
||||||
enum { LABEL_NEXTLINE=1,LABEL_START };
|
enum { LABEL_NEXTLINE=1,LABEL_START };
|
||||||
|
|
||||||
|
TBL_PC *script_rid2sd(struct script_state *st);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get `sd` from an account id in `loc` param instead of attached rid
|
* Get `sd` from an account id in `loc` param instead of attached rid
|
||||||
* @param loc Location to look account id in script parameter
|
* @param loc Location to look account id in script parameter
|
||||||
@ -212,24 +214,22 @@ enum { LABEL_NEXTLINE=1,LABEL_START };
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get `sd` from a nick in `loc` param instead of attached rid
|
* Get `sd` from a nick in `loc` param instead of attached rid
|
||||||
|
* @param st Script
|
||||||
* @param loc Location to look nick in script parameter
|
* @param loc Location to look nick in script parameter
|
||||||
* @param sd Variable that will be assigned
|
* @param sd Variable that will be assigned
|
||||||
* @param ret Optional action when fail to get sd
|
* @param ret Optional action when fail to get sd
|
||||||
**/
|
**/
|
||||||
#define script_nick2sd(loc, sd, ret) {\
|
static void script_nick2sd_(struct script_state *st, uint8 loc, struct map_session_data **sd, const char *func) {
|
||||||
if (script_hasdata(st, (loc))) {\
|
if (script_hasdata(st, loc)) {
|
||||||
if (!((sd) = map_nick2sd(script_getstr(st, loc)))) {\
|
if (!(*sd = map_nick2sd(script_getstr(st, loc))))
|
||||||
ShowError("%s: Player with nick %s is not found.\n", __FUNCTION__, script_getstr(st, (loc)));\
|
ShowError("%s: Player with nick %s is not found.\n", func, script_getstr(st, loc));
|
||||||
(ret);\
|
}
|
||||||
return SCRIPT_CMD_FAILURE;\
|
else
|
||||||
}\
|
*sd = script_rid2sd(st);
|
||||||
}\
|
|
||||||
else if (!((sd) = script_rid2sd(st))) {\
|
|
||||||
(ret);\
|
|
||||||
return SCRIPT_CMD_FAILURE;\
|
|
||||||
}\
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define script_nick2sd(loc,sd) script_nick2sd_(st,(loc),&(sd),__FUNCTION__)
|
||||||
|
|
||||||
/// temporary buffer for passing around compiled bytecode
|
/// temporary buffer for passing around compiled bytecode
|
||||||
/// @see add_scriptb, set_label, parse_script
|
/// @see add_scriptb, set_label, parse_script
|
||||||
static unsigned char* script_buf = NULL;
|
static unsigned char* script_buf = NULL;
|
||||||
@ -7480,7 +7480,11 @@ BUILDIN_FUNC(readparam)
|
|||||||
TBL_PC *sd;
|
TBL_PC *sd;
|
||||||
|
|
||||||
type = script_getnum(st,2);
|
type = script_getnum(st,2);
|
||||||
script_nick2sd(3, sd, script_pushint(st,-1));
|
script_nick2sd(3,sd);
|
||||||
|
if (!sd) {
|
||||||
|
script_pushint(st,-1);
|
||||||
|
return SCRIPT_CMD_FAILURE;
|
||||||
|
}
|
||||||
script_pushint(st,pc_readparam(sd,type));
|
script_pushint(st,pc_readparam(sd,type));
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user