--- a/src/chess/king.c Sat Apr 04 12:35:59 2026 +0200 +++ b/src/chess/king.c Sat Apr 04 13:25:47 2026 +0200 @@ -33,13 +33,12 @@ static bool king_castling_chkmoved(GameState *gamestate, uint8_t row, uint8_t file) { - - MoveList *ml = gamestate->movelist; - while (ml) { - if (ml->move.fromfile == file && ml->move.fromrow == row) { + + for (unsigned i = 0; i < gamestate->movecount; i++) { + if (gamestate->moves[i].fromfile == file + && gamestate->moves[i].fromrow == row) { return true; } - ml = ml->next; } return false; @@ -79,7 +78,7 @@ blocked |= gamestate->board[move->torow][fileidx('b')]; } uint8_t midfile = (move->tofile+move->fromfile)/2; - blocked |= gamestate->lastmove->move.check || + blocked |= last_move(gamestate).check || gamestate->board[move->torow][midfile] || is_covered(gamestate, move->torow, midfile, opponent_color); }