summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 26a8931e6..e3c5aacbe 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -14,6 +14,7 @@
#include "../common/utils.h"
#include "map.h"
+#include "path.h"
#include "chrif.h"
#include "clif.h"
#include "intif.h"
@@ -690,7 +691,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
#ifdef CIRCULAR_AREA
&& check_distance_bl(center, bl, range)
#endif
- && path_search_long(NULL,center->m,center->x,center->y,bl->x,bl->y)
+ && path_search_long(NULL,center->m,center->x,center->y,bl->x,bl->y,CELL_CHKWALL)
&& bl_list_count<BL_LIST_MAX)
bl_list[bl_list_count++]=bl;
}
@@ -707,7 +708,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
#ifdef CIRCULAR_AREA
&& check_distance_bl(center, bl, range)
#endif
- && path_search_long(NULL,center->m,center->x,center->y,bl->x,bl->y)
+ && path_search_long(NULL,center->m,center->x,center->y,bl->x,bl->y,CELL_CHKWALL)
&& bl_list_count<BL_LIST_MAX)
bl_list[bl_list_count++]=bl;
}
@@ -1123,7 +1124,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y
if (k < 0 || k > len_limit) //Since more skills use this, check for ending point as well.
continue;
- if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi))
+ if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi,CELL_CHKWALL))
continue; //Targets beyond the initial ending point need the wall check.
//All these shifts are to increase the precision of the intersection point and distance considering how it's
@@ -1158,7 +1159,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y
if (k < 0 || k > len_limit)
continue;
- if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi))
+ if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi,CELL_CHKWALL))
continue; //Targets beyond the initial ending point need the wall check.
k = (k<<4)/magnitude2; //k will be between 1~16 instead of 0~1
@@ -2194,7 +2195,6 @@ uint8 map_calc_dir(struct block_list* src, int x, int y)
*------------------------------------------*/
int map_random_dir(struct block_list *bl, short *x, short *y)
{
- struct walkpath_data wpd;
short xi = *x-bl->x;
short yi = *y-bl->y;
short i=0, j;
@@ -2210,10 +2210,9 @@ int map_random_dir(struct block_list *bl, short *x, short *y)
xi = bl->x + segment*dirx[j];
segment = (short)sqrt(dist2 - segment*segment); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
- } while ((
- map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) ||
- path_search_real(&wpd,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH) == -1)
- && (++i)<100);
+ } while (
+ (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
+ && (++i)<100 );
if (i < 100) {
*x = xi;