Update main.c

This commit is contained in:
begilbert-sys 2024-01-16 23:19:44 -08:00 committed by GitHub
parent 701b30c7b7
commit 59be269502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

4
main.c
View file

@ -85,7 +85,7 @@ void draw_grid() {
void _addstr_centered(int tile_value) { void _addstr_centered(int tile_value) {
/* draw the tile number so that it's centered */ /* draw the tile number so that it's centered */
int length = 1; int length = 1;
if (tile_value != 0) { if (tile_value != BLANK) {
// calculate length of integer // calculate length of integer
length = log10(tile_value) + 1; length = log10(tile_value) + 1;
} }
@ -112,7 +112,7 @@ void display_board() {
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
int tile_value = board[i][j]; int tile_value = board[i][j];
int color_pair = COLOR_PAIR_DEFAULT; int color_pair = COLOR_PAIR_DEFAULT;
if (tile_value != 0) { if (tile_value != BLANK) {
color_pair = (int)log2(tile_value); color_pair = (int)log2(tile_value);
} }
attron(COLOR_PAIR(color_pair)); attron(COLOR_PAIR(color_pair));