diff options
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 36f3eab45..b1ed24666 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -107,9 +107,9 @@ int unit_walktoxy_sub(struct block_list *bl) ud->walkpath.path_len--; dir = ud->walkpath.path[ud->walkpath.path_len]; if(dir&1) - i-=14; + i -= MOVE_DIAGONAL_COST; else - i-=10; + i -= MOVE_COST; ud->to_x -= dirx[dir]; ud->to_y -= diry[dir]; } @@ -126,7 +126,7 @@ int unit_walktoxy_sub(struct block_list *bl) if(ud->walkpath.path_pos>=ud->walkpath.path_len) i = -1; else if(ud->walkpath.path[ud->walkpath.path_pos]&1) - i = iStatus->get_speed(bl)*14/10; + i = iStatus->get_speed(bl)*MOVE_DIAGONAL_COST/MOVE_COST; else i = iStatus->get_speed(bl); if( i > 0) @@ -346,14 +346,16 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag) if( ud == NULL) return 0; - path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells + if (!path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS)) // Count walk path cells + return 0; + #ifdef OFFICIAL_WALKPATH if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between && (wpd.path_len > (battle_config.max_walk_path/17)*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. return 0; #endif - if( (battle_config.max_walk_path < wpd.path_len) && (bl->type != BL_NPC) ) + if ((wpd.path_len > battle_config.max_walk_path) && (bl->type != BL_NPC)) return 0; if (flag&4 && DIFF_TICK(ud->canmove_tick, iTimer->gettick()) > 0 && |