aboutsummaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'map.c')
-rw-r--r--map.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/map.c b/map.c
index 7fc6fd9..90ca91c 100644
--- a/map.c
+++ b/map.c
@@ -21,7 +21,6 @@ Map empty_map(size_t width, size_t height) {
unsigned int neighbours(Position neighbour_array[], Position pos, size_t width, size_t height, \
char visited[height][width]) {
- //TODO: add thing for when visited is NULL
size_t cur = 0;
if (pos.x > 0 && !visited[pos.y][pos.x - 1]) {
neighbour_array[cur].x = pos.x - 1;
@@ -52,13 +51,13 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed) {
map_height = height * 2 - 1;
Map map = empty_map(map_width, map_height);
- // Vertical walls
+ /* Vertical walls */
for (size_t i = 1; i < map_width; i += 2) {
for (size_t j = 0; j < map_height; j += 1) {
map[j][i] = WALL;
}
}
- // Horizontal walls
+ /* Horizontal walls */
for (size_t i = 1; i < map_height; i += 2) {
for (size_t j = 0; j < map_width; j += 1) {
map[i][j] = WALL;
@@ -67,7 +66,7 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed) {
Position beginning_cell = {width - 1, height - 1};
- char visited[height][width]; // 1 if visited, 0 if not
+ char visited[height][width]; /* 1 if visited, 0 if not */
memset(visited, 0, sizeof(char) * width * height);
PositionStack ps = ps_new();
@@ -95,7 +94,7 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed) {
}
void draw_map(Map map, size_t width, size_t height, Position start, Position goal) {
- // Draw the walls around the map (they are not in map)
+ /* Draw the walls around the map (they are not in map) */
attron(COLOR_PAIR(WALL_COLOR));
for (size_t i = 0; i <= width*2 + 3; i++) {
mvaddch(DRAW_MAP_OFFSET_X - 2, i, WALL_CHAR);
@@ -109,11 +108,11 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa
}
attroff(COLOR_PAIR(WALL_COLOR));
- // Draw field
- char c; // The char for the current tile
+ /* Draw field */
+ char c; /* The char for the current tile */
for (size_t i = 0; i < height; i++) {
for (size_t j = 0; j < width; j++) {
- int color_pair = 0; // The color pair of the current char
+ int color_pair = 0; /* The color pair of the current char */
switch (map[i][j]) {
case EMPTY:
color_pair = COLOR_PAIR(EMPTY_COLOR);
@@ -134,7 +133,7 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa
}
}
- // Draw the start
+ /* Draw the start */
attron(A_BOLD);
attron(COLOR_PAIR(START_COLOR));
mvaddch(start.y + DRAW_MAP_OFFSET_Y, start.x*2 + DRAW_MAP_OFFSET_X, START_CHAR_1);