diff options
author | Haru <haru@dotalux.com> | 2014-10-20 00:38:44 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2014-10-24 00:59:21 +0200 |
commit | 138352558b04de199139d5f8124d6e3c24df8008 (patch) | |
tree | 2d9894bb9c4d630715603860745d3e77ac7851b3 /src/map/script.c | |
parent | 98274e4ab8d5f8cb6381a4a625441c90020dffff (diff) | |
download | hercules-138352558b04de199139d5f8124d6e3c24df8008.tar.gz hercules-138352558b04de199139d5f8124d6e3c24df8008.tar.bz2 hercules-138352558b04de199139d5f8124d6e3c24df8008.tar.xz hercules-138352558b04de199139d5f8124d6e3c24df8008.zip |
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 <haru@dotalux.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 37 |
1 files changed, 19 insertions, 18 deletions
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 { |