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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 41aa35d7e..9e962a5d5 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1484,6 +1484,9 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx
*x = (rx >= 0)?(rand()%rx2-rx+bx):(rand()%(map[m].xs-2)+1);
*y = (ry >= 0)?(rand()%ry2-ry+by):(rand()%(map[m].ys-2)+1);
+ if (*x == bx && *y == by)
+ continue; //Avoid picking the same target tile.
+
if (map_getcell(m,*x,*y,CELL_CHKREACH))
{
if(flag&2 && !unit_can_reach_pos(src, *x, *y, 1))