diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-10 22:16:44 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-10 22:16:44 +0300 |
| commit | d676ac91b1906f5de8695facb6b96bf0509e6e1f (patch) | |
| tree | 5bfe0fb9e89721508202296e87acf7b53c9f011d | |
| parent | 221797b2506bc54483042b8a7beb0aa016f4f8e6 (diff) | |
| download | astar-d676ac91b1906f5de8695facb6b96bf0509e6e1f.tar.xz | |
Clean up trailing whitespaces
| -rw-r--r-- | bmp.c | 4 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | main.c | 6 | ||||
| -rw-r--r-- | map.c | 14 | ||||
| -rw-r--r-- | map.h | 6 | ||||
| -rw-r--r-- | priority_queue.c | 2 | ||||
| -rw-r--r-- | priority_queue.h | 2 | ||||
| -rw-r--r-- | structs.h | 2 |
8 files changed, 19 insertions, 19 deletions
@@ -13,7 +13,7 @@ void map_to_bmp(Map map, size_t map_width, size_t map_height, Position start, Po /* Dimensions of the resulting image */ int32_t width = map_width; int32_t height = map_height; - uint16_t bitcount = 24; + uint16_t bitcount = 24; /* Width of a single row in bytes */ int width_in_bytes = ((width * bitcount + 31) / 32) * 4; @@ -25,7 +25,7 @@ void map_to_bmp(Map map, size_t map_width, size_t map_height, Position start, Po const uint32_t biSize = 40; /* Bitmap bit offset */ - const uint32_t bfOffBits = 54; + const uint32_t bfOffBits = 54; /* Size in bytes of resulting BMP */ uint32_t filesize = 54 + imagesize; @@ -7,7 +7,7 @@ #define ANIM_DELAY_USEC 10*1000 /* The characters that represent different tiles. - * Some have two characters -- that's because of the rendering trick where we + * Some have two characters -- that's because of the rendering trick where we * use two characters back-to-back so they look like a square. */ #define EMPTY_CHAR ' ' #define GOAL_CHAR_1 'G' @@ -16,7 +16,7 @@ /* So, TODO for now: - Allow maps to have costs - - Write out the amount of visited squares (to see how algorithms differ in + - Write out the amount of visited squares (to see how algorithms differ in efficiency) - Map editor function - Rework the UI, probably completely @@ -201,12 +201,12 @@ int main(int argc, char **argv) { path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); } break; - case 'e': + case 'e': is_maze = 0; visited_free(visited, height); path_free(path, height); - map_editor(&map, &width, &height, &start_pos, &end_pos); + map_editor(&map, &width, &height, &start_pos, &end_pos); wrefresh(curscr); visited = visited_new(width, height); @@ -22,7 +22,7 @@ Map empty_map(size_t width, size_t height) { for (size_t row = 0; row < height; row++) { map[row] = malloc(sizeof(MapTile) * width); if (map[row] == NULL) return NULL; - memset(map[row], 0, width*sizeof(MapTile)); + memset(map[row], 0, width*sizeof(MapTile)); } return map; @@ -260,16 +260,16 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa for (size_t j = 0; j < width; j++) { int color_pair = 0; /* The color pair of the current char */ switch (map[i][j]) { - case EMPTY: + case EMPTY: if (visited != NULL && visited[i][j]) color_pair = COLOR_PAIR(VISITED_COLOR); - else + else color_pair = COLOR_PAIR(EMPTY_COLOR); - c = EMPTY_CHAR; + c = EMPTY_CHAR; break; - case WALL: + case WALL: color_pair = COLOR_PAIR(WALL_COLOR); - c = WALL_CHAR; + c = WALL_CHAR; break; } @@ -291,7 +291,7 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa } } } - + /* Render the frontier */ if (frontier != NULL) { attron(COLOR_PAIR(FRONTIER_COLOR)); @@ -21,8 +21,8 @@ unsigned int neighbours_4dir(Position neighbour_array[4], size_t cost_array[4], unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], Position pos, size_t width, size_t height, \ 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! +/* 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! * The actual size for a given dimention is (dimension * 2 - 1) */ Map rbt_maze_map(size_t width, size_t height, unsigned int seed); @@ -42,7 +42,7 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed); * ..@....... */ 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. +/* 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, Position start, Position goal, Position *cursor, Path path, char **visited, PositionPQ *frontier); diff --git a/priority_queue.c b/priority_queue.c index 7e706a8..a6df02b 100644 --- a/priority_queue.c +++ b/priority_queue.c @@ -19,7 +19,7 @@ int ppq_insert(PositionPQ **ppq, Position pos, size_t priority) { (*ppq) = ppq_new(pos, priority); return PPQ_INSERT_NEW; } - + PositionPQ *n = ppq_new(pos, priority); if (start->priority > priority) { diff --git a/priority_queue.h b/priority_queue.h index 241dcc7..f773475 100644 --- a/priority_queue.h +++ b/priority_queue.h @@ -3,7 +3,7 @@ #include "structs.h" -/* This is basically a sorted linked list +/* This is basically a sorted linked list * Pro tip: if you always use the same priority, this becomes a regular queue */ struct PositionPQNode_s { Position pos; @@ -27,7 +27,7 @@ enum Colors_e { CURSOR_COLOR = 8, }; -/* A map is a 2D array of MapTiles. +/* A map is a 2D array of MapTiles. * Use as map[row][column] */ typedef MapTile** Map; |
