From 75d273c052cb46e74c8e5a39dfd68624add091d9 Mon Sep 17 00:00:00 2001 From: Jorge C Date: Sat, 9 Jan 2016 02:41:54 +0100 Subject: Fixes monsters not taking rude attack when OFFICIAL_WALKPATH is used. Rude attack was not checking for this setting. --- src/map/unit.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/unit.c b/src/map/unit.c index 03334f7f3..b00aadf4b 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 -- cgit v1.2.3-70-g09d2