summaryrefslogtreecommitdiff
path: root/src/map/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/path.c')
-rw-r--r--src/map/path.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/map/path.c b/src/map/path.c
index 92ea4941e..c2b852469 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -246,7 +246,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count)
*------------------------------------------
*/
#define swap(x,y) { int t; t = x; x = y; y = t; }
-int path_search_long(int m,int x0,int y0,int x1,int y1)
+int path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1)
{
int dx, dy;
int wx = 0, wy = 0;
@@ -265,13 +265,25 @@ int path_search_long(int m,int x0,int y0,int x1,int y1)
}
dy = (y1 - y0);
+ if (spd) {
+ spd->rx = spd->ry = 0;
+ spd->len = 1;
+ spd->x[0] = x0;
+ spd->y[0] = y0;
+ }
+
if (map_getcellp(md,x1,y1,CELL_CHKWALL))
return 0;
- if (dx > abs(dy))
+ if (dx > abs(dy)) {
weight = dx;
- else
+ if (spd)
+ spd->ry=1;
+ } else {
weight = abs(y1 - y0);
+ if (spd)
+ spd->rx=1;
+ }
while (x0 != x1 || y0 != y1) {
if (map_getcellp(md,x0,y0,CELL_CHKWALL))
@@ -289,6 +301,11 @@ int path_search_long(int m,int x0,int y0,int x1,int y1)
wy += weight;
y0 --;
}
+ if (spd && spd->len<MAX_WALKPATH) {
+ spd->x[spd->len] = x0;
+ spd->y[spd->len] = y0;
+ spd->len++;
+ }
}
return 1;