From 7fd2c1ca96f2972bc53a4a89cb6db582c4f6e2e1 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sat, 14 Mar 2026 15:05:03 +0300 Subject: Rename player into start --- config.h | 4 ++-- main.c | 6 +++--- map.c | 10 +++++----- map.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config.h b/config.h index 3b3cd51..3eb931d 100644 --- a/config.h +++ b/config.h @@ -3,9 +3,9 @@ // The characters that represent different tiles #define EMPTY_CHAR '.' -#define GOAL_CHAR 'X' +#define GOAL_CHAR 'Z' #define WALL_CHAR '#' -#define PLAYER_CHAR '@' +#define START_CHAR 'A' #define DRAW_MAP_OFFSET_X 1 #define DRAW_MAP_OFFSET_Y 1 diff --git a/main.c b/main.c index 0c7aea5..bfa19f5 100644 --- a/main.c +++ b/main.c @@ -24,7 +24,7 @@ void initialize_colors(void) { init_pair(EMPTY_COLOR, COLOR_BLACK, -1); init_pair(GOAL_COLOR, COLOR_CYAN, -1); init_pair(WALL_COLOR, COLOR_WHITE, -1); - init_pair(PLAYER_COLOR, COLOR_RED, -1); + init_pair(START_COLOR, COLOR_RED, -1); } int main(void) { @@ -37,8 +37,8 @@ int main(void) { initialize_colors(); Map map = rbt_maze_map(20, 10, (unsigned int) time(NULL)); - Position fake_player_position_to_pass_into_draw_map = {11, 21}; - draw_map(map, 20*2-1, 10*2-1, fake_player_position_to_pass_into_draw_map); + Position fake_start_position_to_pass_into_draw_map = {11, 21}; + draw_map(map, 20*2-1, 10*2-1, fake_start_position_to_pass_into_draw_map); getch(); endwin(); diff --git a/map.c b/map.c index 3a8ef8f..f83269f 100644 --- a/map.c +++ b/map.c @@ -94,7 +94,7 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed) { return map; } -void draw_map(Map map, int width, int height, Position player_pos) { +void draw_map(Map map, int width, int height, Position start) { // Draw field char c; // The char for the current tile for (int i = 0; i < height; i++) { @@ -121,9 +121,9 @@ void draw_map(Map map, int width, int height, Position player_pos) { } } - // Draw the player - attron(COLOR_PAIR(PLAYER_COLOR)); - mvaddch(player_pos.y + DRAW_MAP_OFFSET_Y, player_pos.x + DRAW_MAP_OFFSET_X, PLAYER_CHAR); - attroff(COLOR_PAIR(PLAYER_COLOR)); + // Draw the start + attron(COLOR_PAIR(START_COLOR)); + mvaddch(start.y + DRAW_MAP_OFFSET_Y, start.x + DRAW_MAP_OFFSET_X, START_CHAR); + attroff(COLOR_PAIR(START_COLOR)); } diff --git a/map.h b/map.h index 9c4a4fa..b06da7c 100644 --- a/map.h +++ b/map.h @@ -16,7 +16,7 @@ enum Colors_e { EMPTY_COLOR = 1, GOAL_COLOR = 2, WALL_COLOR = 3, - PLAYER_COLOR = 4, + START_COLOR = 4, }; // A map is a 2D array of MapTiles. @@ -36,6 +36,6 @@ unsigned int neighbours(Position neighbour_array[], Position pos, size_t width, Map rbt_maze_map(size_t width, size_t height, unsigned int seed); // Draw the map. Bet you didn't expect that. -void draw_map(Map map, int width, int height, Position player_pos); +void draw_map(Map map, int width, int height, Position start); #endif //MAP_H_ -- cgit v1.2.3