diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-20 22:57:32 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-20 22:57:32 +0300 |
| commit | a08e4c138734fd59246e70260c51b9d7b68be007 (patch) | |
| tree | 52d8eec4570acbea5d91177a05549abd9798c5b9 /map.h | |
| parent | a0604cc84ef5286d7fe42a1ad125e654ce7eacf6 (diff) | |
Add ability to read plaintext maps from files
Diffstat (limited to 'map.h')
| -rw-r--r-- | map.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -34,6 +34,22 @@ unsigned int neighbours(Position neighbour_array[], Position pos, size_t width, * TODO: formula for actual size */ Map rbt_maze_map(size_t width, size_t height, unsigned int seed); +/* Reads the map from a file, saves size in `width` and `height` + * + * FILE FORMAT IS AS FOLLOWS: + * {WIDTH}x{HEIGHT} + * {EMPTY_CHAR}{WALL_CHAR}{START_CHAR}{END_CHAR} + * {MAP, one line at a time} + * + * EXAMPLE: + * 10x4 + * .#@x + * .......x.. + * ....###... + * ....#.#... + * ..@....... */ +Map file_plaintext_map(char *filename, size_t *width, size_t *height, Position *start_pos, Position *end_pos); + /* Draw the map. Bet you didn't expect that. */ void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, Position start, Position goal); |
