aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--map.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/map.c b/map.c
index 9917f5f..ff1ab7d 100644
--- a/map.c
+++ b/map.c
@@ -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);