From 9c7f06f7430912dc918e7c54120555bcd56a521e Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 11 Jan 2016 21:05:28 +0100 Subject: [PATCH] Fix reading FEN FRC castling rights when King not on last rank There was still a hard-coded rank 0 / BOARD_HEIGHT-1 there. --- backend.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.c b/backend.c index db04b8e..f46a923 100644 --- a/backend.c +++ b/backend.c @@ -18311,10 +18311,10 @@ ParseFEN (Board board, int *blackPlaysFirst, char *fen, Boolean autoSize) } if(gameInfo.variant == VariantTwoKings || gameInfo.variant == VariantKnightmate) whiteKingFile = blackKingFile = BOARD_WIDTH >> 1; // for these variant scanning fails - if(whiteKingFile == NoRights || board[0][whiteKingFile] != WhiteUnicorn - && board[0][whiteKingFile] != WhiteKing) whiteKingFile = NoRights; - if(blackKingFile == NoRights || board[BOARD_HEIGHT-1][blackKingFile] != BlackUnicorn - && board[BOARD_HEIGHT-1][blackKingFile] != BlackKing) blackKingFile = NoRights; + if(whiteKingFile == NoRights || board[castlingRank[2]][whiteKingFile] != WhiteUnicorn + && board[castlingRank[2]][whiteKingFile] != WhiteKing) whiteKingFile = NoRights; + if(blackKingFile == NoRights || board[castlingRank[5]][blackKingFile] != BlackUnicorn + && board[castlingRank[5]][blackKingFile] != BlackKing) blackKingFile = NoRights; switch(c) { case'K': for(i=BOARD_RGHT-1; board[castlingRank[2]][i]!=WhiteRook && i>whiteKingFile; i--); -- 1.7.0.4