diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2017-04-19 23:52:06 +0800 |
---|---|---|
committer | Jedzkie <jedzkie13@rocketmail.com> | 2017-04-23 11:26:34 +0800 |
commit | 359cc8da6b98c9716e4695b471acbe4d45140be2 (patch) | |
tree | 91a48fe913d6a713657af895b24dbe6024662f0f | |
parent | 94104f0e3c69e2089b42915de74c792acbda9e6d (diff) | |
download | hercules-359cc8da6b98c9716e4695b471acbe4d45140be2.tar.gz hercules-359cc8da6b98c9716e4695b471acbe4d45140be2.tar.bz2 hercules-359cc8da6b98c9716e4695b471acbe4d45140be2.tar.xz hercules-359cc8da6b98c9716e4695b471acbe4d45140be2.zip |
Coding-style Fixes and White space adjustments
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 47 | ||||
-rw-r--r-- | src/map/clif.c | 40 | ||||
-rw-r--r-- | src/map/status.c | 48 |
4 files changed, 70 insertions, 67 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h index 5e650e4e8..7bd5b7c06 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -448,7 +448,7 @@ enum { #endif // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, - OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST|OPTION_SUMMER2, + OPTION_COSTUME = OPTION_WEDDING | OPTION_XMAS | OPTION_SUMMER | OPTION_HANBOK | OPTION_OKTOBERFEST | OPTION_SUMMER2, }; struct s_skill { diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4c746d4ca..afdf180d5 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9248,7 +9248,12 @@ ACMD(searchstore){ searchstore->open(sd, 99, val); return true; } -ACMD(costume){ + +/*========================================== +* @costume +*------------------------------------------*/ +ACMD(costume) +{ const char* names[] = { "Wedding", "Xmas", @@ -9276,37 +9281,40 @@ ACMD(costume){ unsigned short k = 0, len = ARRAYLENGTH(names); if (!*message) { - for( k = 0; k < len; k++ ) { - if( sd->sc.data[name2id[k]] ) { - safesnprintf(atcmd_output, sizeof(atcmd_output),msg_fd(fd,1473),names[k]);//Costume '%s' removed. - clif->message(sd->fd,atcmd_output); - status_change_end(&sd->bl,name2id[k],INVALID_TIMER); + for (k = 0; k < len; k++) { + if (sd->sc.data[name2id[k]]) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1473), names[k]); // Costume '%s' removed. + clif->message(sd->fd, atcmd_output); + status_change_end(&sd->bl, name2id[k], INVALID_TIMER); return true; } } - clif->message(sd->fd,msg_fd(fd,1472)); - for( k = 0; k < len; k++ ) { - safesnprintf(atcmd_output, sizeof(atcmd_output),msg_fd(fd,1471),names[k]);//-- %s - clif->message(sd->fd,atcmd_output); + + clif->message(sd->fd, msg_fd(fd, 1472)); // - Available Costumes + + for (k = 0; k < len; k++) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1471), names[k]); //-- %s + clif->message(sd->fd, atcmd_output); } return false; } - for( k = 0; k < len; k++ ) { - if( sd->sc.data[name2id[k]] ) { - safesnprintf(atcmd_output, sizeof(atcmd_output),msg_fd(fd,1470),names[k]);// You're already with a '%s' costume, type '@costume' to remove it. - clif->message(sd->fd,atcmd_output); + for (k = 0; k < len; k++) { + if (sd->sc.data[name2id[k]]) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1470), names[k]); // You're already with a '%s' costume, type '@costume' to remove it. + clif->message(sd->fd, atcmd_output); return false; } } - for( k = 0; k < len; k++ ) { - if( strcmpi(message,names[k]) == 0 ) + for (k = 0; k < len; k++) { + if (strcmpi(message,names[k]) == 0) break; } - if( k == len ) { - safesnprintf(atcmd_output, sizeof(atcmd_output),msg_fd(fd,1469),message);// '%s' is not a known costume - clif->message(sd->fd,atcmd_output); + + if (k == len) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1469), message); // '%s' is not a known costume + clif->message(sd->fd, atcmd_output); return false; } @@ -9314,6 +9322,7 @@ ACMD(costume){ return true; } + /* for debugging purposes (so users can easily provide us with debug info) */ /* should be trashed as soon as its no longer necessary */ ACMD(skdebug) diff --git a/src/map/clif.c b/src/map/clif.c index fd1ec17bf..09a14f2c2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3194,33 +3194,31 @@ void clif_changelook(struct block_list *bl,int type,int val) vd->shield = val; break; case LOOK_BASE: - if( !sd ) break; + if (sd == NULL) + break; - if ( val == INVISIBLE_CLASS ) /* nothing to change look */ + if (val == INVISIBLE_CLASS) /* nothing to change look */ return; - if( sd->sc.option&OPTION_COSTUME ) + if (sd->sc.option & OPTION_COSTUME) vd->weapon = vd->shield = 0; - if( !vd->cloth_color ) + if (!vd->cloth_color) break; - if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + if ((sd->sc.option & OPTION_WEDDING) != 0 && battle_config.wedding_ignorepalette == true) vd->cloth_color = 0; - if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + if ((sd->sc.option & OPTION_XMAS) != 0 && battle_config.xmas_ignorepalette == true) vd->cloth_color = 0; - if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + if ((sd->sc.option & OPTION_SUMMER) != 0 && battle_config.summer_ignorepalette == true) vd->cloth_color = 0; - if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + if ((sd->sc.option & OPTION_HANBOK) != 0 && battle_config.hanbok_ignorepalette == true) vd->cloth_color = 0; - if (sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette) + if ((sd->sc.option & OPTION_OKTOBERFEST) != 0 && battle_config.oktoberfest_ignorepalette == true) vd->cloth_color = 0; - if (sd->sc.option&OPTION_SUMMER2 && battle_config.summer2_ignorepalette) + if ((sd->sc.option & OPTION_SUMMER2) != 0 && battle_config.summer2_ignorepalette == true) vd->cloth_color = 0; - if (vd->body_style && ( - sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || - sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || - sd->sc.option&OPTION_OKTOBERFEST || sd->sc.option&OPTION_SUMMER2)) + if (vd->body_style != 0 && (sd->sc.option & OPTION_COSTUME) != 0) vd->body_style = 0; break; case LOOK_HAIR: @@ -3239,18 +3237,18 @@ void clif_changelook(struct block_list *bl,int type,int val) vd->hair_color = val; break; case LOOK_CLOTHES_COLOR: - if( val && sd ) { - if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + if (val && sd != NULL) { + if ((sd->sc.option & OPTION_WEDDING) != 0 && battle_config.wedding_ignorepalette == true) val = 0; - if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + if ((sd->sc.option & OPTION_XMAS) != 0 && battle_config.xmas_ignorepalette == true) val = 0; - if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + if ((sd->sc.option & OPTION_SUMMER) != 0 && battle_config.summer_ignorepalette == true) val = 0; - if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + if ((sd->sc.option & OPTION_HANBOK) != 0 && battle_config.hanbok_ignorepalette == true) val = 0; - if( sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette) + if ((sd->sc.option & OPTION_OKTOBERFEST) != 0 && battle_config.oktoberfest_ignorepalette == true) val = 0; - if (sd->sc.option&OPTION_SUMMER2 && battle_config.summer2_ignorepalette) + if ((sd->sc.option & OPTION_SUMMER2) != 0 && battle_config.summer2_ignorepalette == true) val = 0; } vd->cloth_color = val; diff --git a/src/map/status.c b/src/map/status.c index fe09c1b7f..1f068fdbc 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6875,26 +6875,20 @@ void status_set_viewdata(struct block_list *bl, int class_) sd->vd.sex = sd->status.sex; if (sd->vd.cloth_color) { - if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) - sd->vd.cloth_color = 0; - if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) - sd->vd.cloth_color = 0; - if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) - sd->vd.cloth_color = 0; - if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) - sd->vd.cloth_color = 0; - if (sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette) + if ((sd->sc.option & OPTION_WEDDING) != 0 && battle_config.wedding_ignorepalette == true) sd->vd.cloth_color = 0; - if (sd->sc.option&OPTION_SUMMER2 && battle_config.summer2_ignorepalette) + if ((sd->sc.option & OPTION_XMAS) != 0 && battle_config.xmas_ignorepalette == true) + sd->vd.cloth_color = 0; + if ((sd->sc.option & OPTION_SUMMER) != 0 && battle_config.summer_ignorepalette == true) + sd->vd.cloth_color = 0; + if ((sd->sc.option & OPTION_HANBOK) != 0 && battle_config.hanbok_ignorepalette == true) + sd->vd.cloth_color = 0; + if ((sd->sc.option & OPTION_OKTOBERFEST) != 0 && battle_config.oktoberfest_ignorepalette == true) + sd->vd.cloth_color = 0; + if ((sd->sc.option & OPTION_SUMMER2) != 0 && battle_config.summer2_ignorepalette == true) sd->vd.cloth_color = 0; } - if (sd->vd.body_style - && (sd->sc.option&OPTION_WEDDING - || sd->sc.option&OPTION_XMAS - || sd->sc.option&OPTION_SUMMER - || sd->sc.option&OPTION_HANBOK - || sd->sc.option&OPTION_OKTOBERFEST - || sd->sc.option&OPTION_SUMMER2)) + if (sd->vd.body_style != 0 && (sd->sc.option & OPTION_COSTUME) != 0) sd->vd.body_style = 0; } else if (vd != NULL) { memcpy(&sd->vd, vd, sizeof(struct view_data)); @@ -8499,8 +8493,9 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_HANBOK: case SC_OKTOBERFEST: case SC_DRESS_UP: - if (!vd) return 0; - //Store previous values as they could be removed. + if (vd == NULL) + return 0; + // Store previous values as they could be removed. unit->stop_attack(bl); break; case SC_NOCHAT: @@ -9895,20 +9890,21 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t return 0; } } - } else { //Special considerations when loading SC data. - switch( type ) { + } else { // Special considerations when loading SC data. + switch (type) { case SC_WEDDING: case SC_XMAS: case SC_SUMMER: case SC_HANBOK: case SC_OKTOBERFEST: case SC_DRESS_UP: - if( !vd ) break; + if (vd == NULL) + break; clif->changelook(bl, LOOK_BASE, vd->class); - clif->changelook(bl,LOOK_WEAPON,0); - clif->changelook(bl,LOOK_SHIELD,0); - clif->changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color); - clif->changelook(bl,LOOK_BODY2,0); + clif->changelook(bl, LOOK_WEAPON, 0); + clif->changelook(bl, LOOK_SHIELD, 0); + clif->changelook(bl, LOOK_CLOTHES_COLOR, vd->cloth_color); + clif->changelook(bl, LOOK_BODY2, 0); break; case SC_KAAHI: val4 = INVALID_TIMER; |