From 138352558b04de199139d5f8124d6e3c24df8008 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 20 Oct 2014 00:38:44 +0200 Subject: pc_isriding* / pc_setriding* cleanup - pc_isriding is now renamed to pc_isridingpeco, since that's what it checks (to avoid confusion). - pc_hasmount is added, to check for any of Peco, Dragon, Mado Gear, Wug Rider. - pc->setridingdragon is added. - pc->setridingwug is added. - pc->setfalcon type is changed. - pc->setmadogear type is changed. - pc->setridign is changed to pc->setridingpeco to avoid confusion. - Changed direct accesses to sd->sd.option to the proper pc_is* accessors, where applicable. - Special thanks to Kisuka. Signed-off-by: Haru --- src/map/script.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 0588d2f24..24011c910 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8635,10 +8635,10 @@ BUILDIN(checkfalcon) TBL_PC* sd; sd = script->rid2sd(st); - if( sd == NULL ) + if (sd == NULL) return true;// no player attached, report source - if( pc_isfalcon(sd) ) + if (pc_isfalcon(sd)) script_pushint(st, 1); else script_pushint(st, 0); @@ -8653,15 +8653,15 @@ BUILDIN(checkfalcon) /// setfalcon; BUILDIN(setfalcon) { - int flag = 1; + bool flag = true; TBL_PC* sd; sd = script->rid2sd(st); - if( sd == NULL ) + if (sd == NULL) return true;// no player attached, report source - if( script_hasdata(st,2) ) - flag = script_getnum(st,2); + if (script_hasdata(st,2)) + flag = script_getnum(st,2) ? true : false; pc->setfalcon(sd, flag); @@ -8678,10 +8678,10 @@ BUILDIN(checkriding) TBL_PC* sd; sd = script->rid2sd(st); - if( sd == NULL ) - return true;// no player attached, report source + if (sd == NULL) + return true; // no player attached, report source - if( pc_isriding(sd) || pc_isridingwug(sd) || pc_isridingdragon(sd) ) + if (pc_hasmount(sd)) script_pushint(st, 1); else script_pushint(st, 0); @@ -8700,12 +8700,13 @@ BUILDIN(setriding) TBL_PC* sd; sd = script->rid2sd(st); - if( sd == NULL ) + + if (sd == NULL) return true;// no player attached, report source - if( script_hasdata(st,2) ) + if (script_hasdata(st,2)) flag = script_getnum(st,2); - pc->setriding(sd, flag); + pc->setridingpeco(sd, flag ? true : false); return true; } @@ -8757,15 +8758,15 @@ BUILDIN(checkmadogear) /// setmadogear; BUILDIN(setmadogear) { - int flag = 1; + bool flag = true; TBL_PC* sd; sd = script->rid2sd(st); - if( sd == NULL ) + if (sd == NULL) return true;// no player attached, report source - if( script_hasdata(st,2) ) - flag = script_getnum(st,2); + if (script_hasdata(st,2)) + flag = script_getnum(st,2) ? true : false; pc->setmadogear(sd, flag); return true; @@ -17383,9 +17384,9 @@ BUILDIN(ismounting) { **/ BUILDIN(setmounting) { TBL_PC* sd; - if( (sd = script->rid2sd(st)) == NULL ) + if ((sd = script->rid2sd(st)) == NULL) return true; - if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) { + if (pc_hasmount(sd)) { clif->msgtable(sd->fd, 0X78b); script_pushint(st,0);//can't mount with one of these } else { -- cgit v1.2.3-60-g2f50