--- a/src/main.c Tue Aug 25 18:35:18 2026 +0200 +++ b/src/main.c Tue Aug 25 18:59:18 2026 +0200 @@ -277,17 +277,18 @@ return 0; } -static void draw_board(GameState *gamestate, uint8_t perspective) { +static void draw_board(GameState *gamestate, Color perspective) { if (gamestate->movecount == 0) { mvaddstr(0, 0, gamestate->fen_start); } else { mvaddstr(0, 0, gamestate->fen[gamestate->movecount - 1]); } - for (uint8_t y = 0 ; y < 8 ; y++) { - for (uint8_t x = 0 ; x < 8 ; x++) { - uint8_t col = gamestate->board[y][x] & COLOR_MASK; - uint8_t piece = gamestate->board[y][x]; + for (Rank y = 0 ; y < 8 ; y++) { + for (File x = 0 ; x < 8 ; x++) { + Piece piece = piece_at(gamestate, y, x); + Color col = piece_color(piece); + char piecestr[5]; if (piece) { if (settings.unicode) { @@ -438,7 +439,7 @@ } #define MOVESTR_BUFLEN 10 -static int domove_singlemachine(GameState *gamestate, uint8_t curcolor) { +static int domove_singlemachine(GameState *gamestate, Color curcolor) { size_t bufpos = 0; char movestr[MOVESTR_BUFLEN]; @@ -524,8 +525,8 @@ .mtime_sec = net_htonl(move.movetime / 1000000ull), .mtime_usec = net_htonl(move.movetime % 1000000ull), .piece = move.piece, - .fromfile = move.fromfile, .fromrow = move.fromrow, - .tofile = move.tofile, .torow = move.torow, + .fromfile = move.fromfile, .fromrank = move.fromrank, + .tofile = move.tofile, .torank = move.torank, .capture = move.capture, .check_or_mate = move.checkmate + move.check, .promotion = move.promotion, @@ -539,8 +540,8 @@ .movetime = (uint64_t)net_ntohl(move.mtime_sec) * 1000000ull + net_ntohl(move.mtime_usec), .piece = move.piece, - .fromfile = move.fromfile, .fromrow = move.fromrow, - .tofile = move.tofile, .torow = move.torow, + .fromfile = move.fromfile, .fromrank = move.fromrank, + .tofile = move.tofile, .torank = move.torank, .promotion = move.promotion, .check = move.check_or_mate, .checkmate = move.check_or_mate >> 1, @@ -548,7 +549,7 @@ }; } -static int sendmove(GameState *gamestate, int opponent, uint8_t mycolor) { +static int sendmove(GameState *gamestate, int opponent, Color mycolor) { size_t bufpos = 0; char movestr[MOVESTR_BUFLEN]; @@ -695,7 +696,7 @@ } } -static int recvmove(GameState *gamestate, int opponent, uint8_t mycolor) { +static int recvmove(GameState *gamestate, int opponent, Color mycolor) { memset(gamestate->premove, 0, sizeof(gamestate->premove)); size_t bufpos = 0; @@ -960,11 +961,11 @@ static void game_play_singlemachine(GameState *gamestate) { inputy = getmaxy(stdscr) - 6; - uint8_t curcol = current_color(gamestate); + Color curcol = current_color(gamestate); bool running = is_game_running(gamestate); while (running) { clear(); - uint8_t perspective = settings.disableflip ? WHITE : curcol; + Color perspective = settings.disableflip ? WHITE : curcol; draw_board(gamestate, perspective); running = !domove_singlemachine(gamestate, curcol); curcol = opponent_color(curcol); @@ -975,7 +976,7 @@ static void game_play(GameState *gamestate, int opponent, bool as_client) { inputy = getmaxy(stdscr) - 6; - uint8_t mycolor = gamestate->info.servercolor; + Color mycolor = gamestate->info.servercolor; if (as_client) { mycolor = opponent_color(mycolor); } @@ -1026,7 +1027,7 @@ } else { printw("%s", gamestate->moves[i].string); } - // only five moves reliably fit into one screen row + // only five moves reliably fit into one screen rank if ((i+1) % 10) { addch(' '); } else {