diff options
author | skyleo <skyleo@skyleo.de> | 2019-10-03 19:12:15 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-03-08 20:56:27 +0100 |
commit | 2351fb29487eb11df3c9d563f5ade84ece4e8d0b (patch) | |
tree | f81b6ae5fb8d472fb2f5ade84d6359214f7cb294 /src/map | |
parent | f4039d8b2c28b06b160fa44e27908856646633a7 (diff) | |
download | hercules-2351fb29487eb11df3c9d563f5ade84ece4e8d0b.tar.gz hercules-2351fb29487eb11df3c9d563f5ade84ece4e8d0b.tar.bz2 hercules-2351fb29487eb11df3c9d563f5ade84ece4e8d0b.tar.xz hercules-2351fb29487eb11df3c9d563f5ade84ece4e8d0b.zip |
Update Coding Style in unit->walktoxy_sub
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/unit.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index d6eb6c30f..d1abed1d0 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -130,21 +130,22 @@ static int unit_walktoxy_sub(struct block_list *bl) struct walkpath_data wpd = {0}; - if( !path->search(&wpd,bl,bl->m,bl->x,bl->y,ud->to_x,ud->to_y,ud->state.walk_easy,CELL_CHKNOPASS) ) + if (!path->search(&wpd, bl, bl->m, bl->x, bl->y, ud->to_x, ud->to_y, ud->state.walk_easy, CELL_CHKNOPASS)) return 0; #ifdef OFFICIAL_WALKPATH - if( !path->search_long(NULL, bl, bl->m, bl->x, bl->y, ud->to_x, ud->to_y, CELL_CHKNOPASS) // Check if there is an obstacle between - && wpd.path_len > 14 // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett] - && (bl->type != BL_NPC) ) // If type is a NPC, please disregard. + if (bl->type != BL_NPC // If type is an NPC, disregard. + && !path->search_long(NULL, bl, bl->m, bl->x, bl->y, ud->to_x, ud->to_y, CELL_CHKNOPASS) // Check if there is an obstacle between + && wpd.path_len > 14) { // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett] return 0; + } #endif ud->walkpath = wpd; - if (ud->target_to && ud->chaserange>1) { - //Generally speaking, the walk path is already to an adjacent tile - //so we only need to shorten the path if the range is greater than 1. + if (ud->target_to != 0 && ud->chaserange > 1) { + // Generally speaking, the walk path is already to an adjacent tile + // so we only need to shorten the path if the range is greater than 1. // Trim the last part of the path to account for range, // but always move at least one cell when requested to move. @@ -152,8 +153,8 @@ static int unit_walktoxy_sub(struct block_list *bl) uint8 dir; ud->walkpath.path_len--; dir = ud->walkpath.path[ud->walkpath.path_len]; - if (dir&1) - i -= MOVE_COST*20; //When chasing, units will target a diamond-shaped area in range [Playtester] + if ((dir & 1) != 0) + i -= MOVE_COST * 20; // When chasing, units will target a diamond-shaped area in range [Playtester] else i -= MOVE_COST; ud->to_x -= dirx[dir]; @@ -161,7 +162,7 @@ static int unit_walktoxy_sub(struct block_list *bl) } } - ud->state.change_walk_target=0; + ud->state.change_walk_target = 0; if (bl->type == BL_PC) { struct map_session_data *sd = BL_UCAST(BL_PC, bl); |