diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-28 19:33:49 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-28 19:33:49 +0300 |
| commit | 1f0dd604952e39d030367b2bbf45b69f8c63cc5b (patch) | |
| tree | a1389804dbb9301a6691704e4c5c0eb829df4a4b /map.h | |
| parent | 5b623c0a31d6732dd03ba8db80004e5468bc08c3 (diff) | |
| download | astar-1f0dd604952e39d030367b2bbf45b69f8c63cc5b.tar.xz | |
Allow resizing the map + some other stuff
Diffstat (limited to 'map.h')
| -rw-r--r-- | map.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -11,12 +11,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[4], size_t cost_array[4], Position pos, size_t width, size_t height, \ - char visited[height][width]); + char **visited); /* 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]); + char **visited); /* https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search * WARNING: width and height are not the width and height of the returned map! @@ -41,7 +41,7 @@ Map file_plaintext_map(char *filename, size_t *width, size_t *height, Position * /* Draw the map. Bet you didn't expect that. * path could be NULL to draw a map with no path. So can cursor, frontier and visited */ -void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, Position start, Position goal, Position *cursor, Path path, char visited[height][width], PositionPQ *frontier); +void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, Position start, Position goal, Position *cursor, Path path, char **visited, PositionPQ *frontier); /* Frees all the memory reserved for the map */ void map_free(Map map, size_t height); |
