summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-07-26 09:59:30 -0300
committershennetsind <ind@henn.et>2013-07-26 09:59:30 -0300
commitb23563de5f9abde73600f84aff1d24d9f3b53bc5 (patch)
tree21ed35a07c74c224957b888b12e387cdd3751561 /src/map/unit.c
parent583272234fc96da7911029cd3cad13a7fb386e9e (diff)
parente9e8914ebfa70c1c212d0a7d7173b6da9e0e5b60 (diff)
downloadhercules-b23563de5f9abde73600f84aff1d24d9f3b53bc5.tar.gz
hercules-b23563de5f9abde73600f84aff1d24d9f3b53bc5.tar.bz2
hercules-b23563de5f9abde73600f84aff1d24d9f3b53bc5.tar.xz
hercules-b23563de5f9abde73600f84aff1d24d9f3b53bc5.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c12
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 &&