From 3f1deb08626c8ca9043cc8250146560588753c0a Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Mon, 14 Dec 2015 14:29:22 +0800 Subject: Change map->charid2sd into script->charid2sd - *charid2rid is exempted to check the condition Signed-off-by: Haru --- src/map/script.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 44566a971..cc4de43ac 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5958,8 +5958,8 @@ BUILDIN(warpchar) { y=script_getnum(st,4); a=script_getnum(st,5); - sd = map->charid2sd(a); - if( sd == NULL ) + sd = script->charid2sd(st, a); + if (sd == NULL) return true; if(strcmp(str, "Random") == 0) @@ -7367,9 +7367,9 @@ BUILDIN(getnameditem) { if( script_isstringtype(st, 3) ) //Char Name tsd=map->nick2sd(script_getstr(st, 3)); else //Char Id was given - tsd=map->charid2sd(script_getnum(st, 3)); + tsd = script->charid2sd(st, script_getnum(st, 3)); - if( tsd == NULL ) { + if (tsd == NULL) { //Failed script_pushint(st,0); return true; @@ -10048,16 +10048,16 @@ BUILDIN(clone) { m = map->mapname2mapid(mapname); if (m < 0) return true; - sd = map->charid2sd(char_id); + sd = script->charid2sd(st, char_id); if (master_id) { msd = map->charid2sd(master_id); - if (msd) + if (msd != NULL) master_id = msd->bl.id; else master_id = 0; } - if (sd) //Return ID of newly crafted clone. + if (sd != NULL) //Return ID of newly crafted clone. script_pushint(st,mob->clone_spawn(sd, m, x, y, event, master_id, mode, flag, 1000*duration)); else //Failed to create clone. script_pushint(st,0); @@ -12645,8 +12645,8 @@ BUILDIN(warppartner) TBL_PC *sd=script->rid2sd(st); TBL_PC *p_sd=NULL; - if ( sd==NULL || !pc->ismarried(sd) - || (p_sd=map->charid2sd(sd->status.partner_id)) == NULL) { + if (sd == NULL || !pc->ismarried(sd) + || (p_sd = script->charid2sd(st, sd->status.partner_id)) == NULL) { script_pushint(st,0); return true; } @@ -13724,10 +13724,9 @@ BUILDIN(getmercinfo) if (script_hasdata(st,3)) { int char_id = script_getnum(st,3); - if ((sd = map->charid2sd(char_id)) == NULL) { - ShowError("buildin_getmercinfo: No such character (char_id=%d).\n", char_id); + if ((sd = script->charid2sd(st, char_id)) == NULL) { script_pushnil(st); - return false; + return true; } } else { if ((sd = script->rid2sd(st)) == NULL) -- cgit v1.2.3-60-g2f50