aboutsummaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-26 12:54:15 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-26 12:54:15 +0300
commit492ed6b629d5f1e22fd53f2f44b911d0a45d01f7 (patch)
treeef0e0e0faa84e64d4560d400bff89b76bee75474 /map.h
parent056ffbf79ff554d7338b0234a2e69b66eb799da1 (diff)
downloadastar-492ed6b629d5f1e22fd53f2f44b911d0a45d01f7.tar.xz
Add cost_array into neighbours_8dir()
Diffstat (limited to 'map.h')
-rw-r--r--map.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/map.h b/map.h
index d940357..ef76a7c 100644
--- a/map.h
+++ b/map.h
@@ -10,10 +10,12 @@
Map empty_map(size_t width, size_t height);
/* Stores all the existing 4dir neighbours of pos in neighbour_array and returns their amount */
-unsigned int neighbours_4dir(Position neighbour_array[], Position pos, size_t width, size_t height, \
+unsigned int neighbours_4dir(Position neighbour_array[4], Position pos, size_t width, size_t height, \
char visited[height][width]);
-/* Stores all the existing 8dir neighbours of pos in neighbour_array and returns their amount */
-unsigned int neighbours_8dir(Position neighbour_array[], Position pos, size_t width, size_t height, \
+/* Stores all the existing 8dir neighbours of pos in neighbour_array and returns their amount.
+ * Additionaly stores costs into cost_array if it's not NULL.
+ * The cost of goint orthogonally is 10, diagonaly is 14 (sqrt(2) * 10) */
+unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], Position pos, size_t width, size_t height, \
char visited[height][width]);
/* https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search