diff -r 619f07c95894 -r 27d02ccb0cef src/chess/king.c --- a/src/chess/king.c Tue Aug 25 18:59:18 2026 +0200 +++ b/src/chess/king.c Tue Aug 25 19:42:15 2026 +0200 @@ -31,7 +31,7 @@ #include "king.h" static bool king_castling_chkmoved( - const GameState *gamestate, Rank rank, File file) { + const GameState *gamestate, File file, Rank rank) { for (unsigned i = 0; i < gamestate->movecount; i++) { if (gamestate->moves[i].fromfile == file @@ -55,9 +55,9 @@ (move->tofile == fileidx('c') || move->tofile == fileidx('g'))) { return !king_castling_chkmoved(gamestate, - move->fromrank, move->fromfile) && - !king_castling_chkmoved(gamestate, move->fromrank, - move->tofile == fileidx('c') ? 0 : 7); + move->fromfile, move->fromrank) && + !king_castling_chkmoved(gamestate, + move->tofile == fileidx('c') ? 0 : 7, move->fromrank); } else { return false; } @@ -82,14 +82,14 @@ incheck = is_check_position(gamestate); } blocked |= incheck || gamestate->board[move->torank][midfile] || - is_covered(gamestate, move->torank, midfile, op_color); + is_covered(gamestate, midfile, move->torank, op_color); } return blocked; } size_t king_moves(const GameState *gamestate, - Color c, Rank r, File f, Move *moves) { + Color c, File f, Rank r, Move *moves) { size_t count = 0; Piece king = mkpiece(KING, c); @@ -113,7 +113,7 @@ moves[count].fromfile = f; moves[count].torank = torank; moves[count].tofile = tofile; - moves[count].capture = piece_at(gamestate, torank, tofile) != 0; + moves[count].capture = piece_at(gamestate, tofile, torank) != 0; count++; } }