diff options
Diffstat (limited to 'map.c')
| -rw-r--r-- | map.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -655,13 +655,16 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi *map = new_map; /* Make sure start and goal aren't outside of the map */ - /* FIXME: they can get stuck in walls */ if (start->y >= *height) { start->y = *height - 1; } if (goal->y >= *height) { goal->y = *height - 1; } + if ((*map)[goal->y][goal->x] == WALL || (*map)[start->y][start->x] == WALL) { + set_message("WARNING: start or goal is on a wall"); + print_message(*height); + } if (should_pathfind) { visited = visited_new(*width, *height); @@ -709,6 +712,10 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi if (goal->x >= *width) { goal->x = *width - 1; } + if ((*map)[goal->y][goal->x] == WALL || (*map)[start->y][start->x] == WALL) { + set_message("WARNING: start or goal is on a wall"); + print_message(*height); + } if (should_pathfind) { visited = visited_new(*width, *height); |
