From 1bed3ac57906b26ef05b25c2bc5c1dca424dba4a Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 1 Jan 2022 13:51:51 +0100 Subject: refactor: fix memory leaks & general improvements --- src/maze.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/maze.h') diff --git a/src/maze.h b/src/maze.h index 38dfe12..8c66ff7 100644 --- a/src/maze.h +++ b/src/maze.h @@ -3,23 +3,33 @@ #include "position_stack.h" -struct Dimensions +typedef struct Dimensions { int width; int height; -}; +} Dimensions; -struct Maze +typedef struct Maze { char ***grid; - struct Dimensions dimens; - struct Dimensions full_dimens; -}; + Dimensions dimens; + Dimensions full_dimens; +} Maze; -struct Maze maze_create(struct Dimensions dimens, char *wall); +Maze maze_create(Dimensions dimens, char *wall); -void maze_excavate(struct Maze maze, struct Position start_pos); +void maze_destroy(Maze *maze); -void maze_print(struct Maze maze); +/** + * Excavates a maze. + * + * This is what creates the actual maze. + * + * @param maze The maze to excavate + * @param start_pos Start position + */ +void maze_excavate(Maze *maze, Position start_pos); + +void maze_print(Maze maze); #endif -- cgit v1.2.3-18-g5258