summaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2022-12-11 16:14:54 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2022-12-11 16:14:54 +0100
commit24af775b5041cbed67dfc84f3a0d67850a4b6a1b (patch)
tree8858ba5158aa7a4b78e12ecbd17b509afda3f9d7 /map.c
parent4933a7c038087ae465e588fafb392a57d7f92b87 (diff)
pathfinding
Diffstat (limited to 'map.c')
-rw-r--r--map.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/map.c b/map.c
index e6f7fd5..15a7c70 100644
--- a/map.c
+++ b/map.c
@@ -26,19 +26,19 @@ static int get_height_of_tile_tl(int current_height, int x, int y) {
static int get_height_of_tile_br(int current_height, int x, int y) {
int highest_point = current_height;
- if (x < 9) {
+ if (x < MAP_SIZE_X-1) {
int tile_right = map[y][x+1];
if (tile_right > highest_point) {
highest_point = tile_right;
}
}
- if (y < 9 && x < 9) {
+ if (y < MAP_SIZE_Y-1 && x < MAP_SIZE_X-1) {
int tile_bottom_right = map[y+1][x+1];
if (tile_bottom_right > highest_point) {
highest_point = tile_bottom_right;
}
}
- if (y < 9) {
+ if (y < MAP_SIZE_Y-1) {
int tile_bottom = map[y+1][x];
if (tile_bottom > highest_point) {
highest_point = tile_bottom;
@@ -55,13 +55,13 @@ static int get_height_of_tile_bl(int current_height, int x, int y) {
highest_point = tile_left;
}
}
- if (y < 9 && x > 0) {
+ if (y < MAP_SIZE_Y-1 && x > 0) {
int tile_bottom_left = map[y+1][x-1];
if (tile_bottom_left > highest_point) {
highest_point = tile_bottom_left;
}
}
- if (y < 9) {
+ if (y < MAP_SIZE_Y-1) {
int tile_bottom = map[y+1][x];
if (tile_bottom > highest_point) {
highest_point = tile_bottom;
@@ -78,13 +78,13 @@ static int get_height_of_tile_tr(int current_height, int x, int y) {
highest_point = tile_above;
}
}
- if (y > 0 && x < 9) {
+ if (y > 0 && x < MAP_SIZE_X-1) {
int tile_above_right = map[y-1][x+1];
if (tile_above_right > highest_point) {
highest_point = tile_above_right;
}
}
- if (x < 9) {
+ if (x < MAP_SIZE_X-1) {
int tile_right = map[y][x+1];
if (tile_right > highest_point) {
highest_point = tile_right;