Skip to content

Commit

Permalink
Item no longer needs its color field
Browse files Browse the repository at this point in the history
  • Loading branch information
noncombatant committed May 15, 2023
1 parent 5150d26 commit bde9153
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions robotfindskitten.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ static const unsigned int White = 7;
typedef struct Item {
int x;
int y;
unsigned int color;
char* icon;
} Item;

Expand Down Expand Up @@ -200,6 +199,17 @@ static void InitializeGame(size_t non_kitten_count) {
cbreak();
intrflush(stdscr, false);
keypad(stdscr, true);
start_color();
if (has_colors() && (COLOR_PAIRS > 7)) {
init_pair(1, COLOR_GREEN, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
bkgd((chtype)COLOR_PAIR(White));
}

if (((LINES - HeaderSize - FrameThickness) * COLS) <
(int)(non_kitten_count + 2)) {
Expand Down Expand Up @@ -238,18 +248,6 @@ static void InitializeGame(size_t non_kitten_count) {
}
}
}

start_color();
if (has_colors() && (COLOR_PAIRS > 7)) {
init_pair(1, COLOR_GREEN, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
bkgd((chtype)COLOR_PAIR(White));
}
}

static void DrawItem(const Item* o) {
Expand Down

0 comments on commit bde9153

Please sign in to comment.