aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-16 18:58:34 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-16 18:58:34 +0300
commitc524f660a79c33213f873b8246e0f65eb058331f (patch)
tree6f72f7305f35b97abab669f20c61b67da68ef80a
parent76067d0625f35f85f0bf775f83c12447d5d12a21 (diff)
Change comments to use /* asdf */ syntax
-rw-r--r--config.h2
-rw-r--r--main.c10
-rw-r--r--map.c17
-rw-r--r--map.h18
-rw-r--r--priority_queue.c2
-rw-r--r--stack.c2
6 files changed, 25 insertions, 26 deletions
diff --git a/config.h b/config.h
index 096fd32..096f612 100644
--- a/config.h
+++ b/config.h
@@ -14,4 +14,4 @@
#define DRAW_MAP_OFFSET_X 2
#define DRAW_MAP_OFFSET_Y 1
-#endif //CONFIG_H_
+#endif /*CONFIG_H_ */
diff --git a/main.c b/main.c
index 5348807..46ab67a 100644
--- a/main.c
+++ b/main.c
@@ -13,7 +13,7 @@
- Render goal and start in bold */
void sigint_handler(int sig) {
- (void)sig; // We know it's a SIGINT
+ (void)sig; /* We know it's a SIGINT */
endwin();
printf("Received SIGINT\n");
exit(1);
@@ -32,10 +32,10 @@ void initialize_colors(void) {
int main(void) {
signal(SIGINT, sigint_handler);
- initscr(); // Initialize the ncurses screen
- cbreak(); // Process input one char at a time
- curs_set(0); // Hide the cursor
- noecho(); // Don't echo characters
+ initscr(); /* Initialize the ncurses screen */
+ cbreak(); /* Process input one char at a time */
+ curs_set(0); /* Hide the cursor */
+ noecho(); /* Don't echo characters */
initialize_colors();
Map map = rbt_maze_map(20, 10, (unsigned int) time(NULL));
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);
diff --git a/map.h b/map.h
index 7cea584..3ce2e7f 100644
--- a/map.h
+++ b/map.h
@@ -18,23 +18,23 @@ enum Colors_e {
START_COLOR = 4,
};
-// A map is a 2D array of MapTiles.
-// Use as map[row][column]
+/* A map is a 2D array of MapTiles.
+ * Use as map[row][column] */
typedef MapTile** Map;
-// Returns an empty map of given size
+/* Returns an empty map of given size */
Map empty_map(size_t width, size_t height);
-// Stores all the existing neighbours of pos in neighbour_array and returns their amount
+/* Stores all the existing neighbours of pos in neighbour_array and returns their amount */
unsigned int neighbours(Position neighbour_array[], Position pos, size_t width, size_t height, \
char visited[height][width]);
-// 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!
-// TODO: formula for actual size
+/* 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!
+ * TODO: formula for actual size */
Map rbt_maze_map(size_t width, size_t height, unsigned int seed);
-// Draw the map. Bet you didn't expect that.
+/* Draw the map. Bet you didn't expect that. */
void draw_map(Map map, size_t width, size_t height, Position start, Position goal);
-#endif //MAP_H_
+#endif /*MAP_H_ */
diff --git a/priority_queue.c b/priority_queue.c
index ac5f254..60e99c4 100644
--- a/priority_queue.c
+++ b/priority_queue.c
@@ -1,5 +1,5 @@
#include "priority_queue.h"
-//TODO: implement
+/*TODO: implement */
typedef int the_compiler_isnt_happy_about_an_empty_file;
diff --git a/stack.c b/stack.c
index cf169c5..c915afd 100644
--- a/stack.c
+++ b/stack.c
@@ -8,7 +8,7 @@ PositionStack ps_new(void) {
}
int ps_push(PositionStack *ps, Position pos) {
- //TODO: check for stack overflow
+ /*TODO: check for stack overflow */
ps->arr[ps->top] = pos;
ps->top += 1;
return 0;