diff -r f0fc70b6f8f9 -r 2a6d83f4677e src/chess/fen.c --- a/src/chess/fen.c Thu Jul 30 18:34:15 2026 +0200 +++ b/src/chess/fen.c Thu Jul 30 19:17:38 2026 +0200 @@ -42,7 +42,7 @@ str[i++] = '0'+skip; skip = 0; } - switch (gamestate->board[row][file] & ~ENPASSANT_THREAT) { + switch (piece_at(gamestate, row, file)) { case WHITE|KING: str[i++] = 'K'; break; case WHITE|QUEEN: str[i++] = 'Q'; break; case WHITE|BISHOP: str[i++] = 'B'; break; @@ -120,11 +120,11 @@ str[0] = '-'; for (int file = 0 ; file < 8 ; file++) { - if (gamestate->board[3][file] & ENPASSANT_THREAT) { + if (enpassant_threat_exists(gamestate, 3, file)) { str[0] = filechr(file); str[1] = rowchr(2); } - if (gamestate->board[4][file] & ENPASSANT_THREAT) { + if (enpassant_threat_exists(gamestate, 4, file)) { str[0] = filechr(file); str[1] = rowchr(5); } @@ -137,7 +137,7 @@ unsigned int hm = 0; for (unsigned int i = 0; i < gamestate->movecount; i++) { if (gamestate->moves[i].capture - || (gamestate->moves[i].piece & PIECE_MASK) == PAWN) { + || piece_type(gamestate->moves[i].piece) == PAWN) { hm = 0; } else { hm++;