diff options
-rw-r--r-- | src/map/unit.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 26104e4e0..bea0913d2 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1976,6 +1976,7 @@ bool unit_can_reach_pos(struct block_list *bl,int x,int y, int easy) bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y) { short dx,dy; + struct walkpath_data wpd; nullpo_retr(false, bl); nullpo_retr(false, tbl); @@ -2005,7 +2006,20 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, if (x) *x = tbl->x-dx; if (y) *y = tbl->y-dy; - return path->search(NULL,bl,bl->m,bl->x,bl->y,tbl->x-dx,tbl->y-dy,easy,CELL_CHKNOREACH); + + if (!path->search(&wpd,bl,bl->m,bl->x,bl->y,tbl->x-dx,tbl->y-dy,easy,CELL_CHKNOREACH)) + return false; + +#ifdef OFFICIAL_WALKPATH + if( !path->search_long(NULL, bl, bl->m, bl->x, bl->y, tbl->x-dx, tbl->y-dy, 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. + return false; +#endif + + return true; + + } /*========================================== * Calculates position of Pet/Mercenary/Homunculus/Elemental |