From: H.G.Muller Date: Mon, 11 Jan 2016 21:44:04 +0000 (+0100) Subject: Fix writing FEN castling rights for non-edge 'Rooks' X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=20c445baafd24d2e66f3157f11b7022fdbd56b75;p=xboard.git Fix writing FEN castling rights for non-edge 'Rooks' Non-Fischer castling rights were only recognized on FEN writing when the castling partner was in the corner. Now it can be anywhere on the correct side of the King. --- diff --git a/backend.c b/backend.c index f46a923..3179ece 100644 --- a/backend.c +++ b/backend.c @@ -18007,9 +18007,9 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) /* [HGM] write true castling rights */ if( nrCastlingRights == 6 ) { int q, k=0; - if(boards[move][CASTLING][0] == BOARD_RGHT-1 && + if(boards[move][CASTLING][0] != NoRights && boards[move][CASTLING][2] != NoRights ) k = 1, *p++ = 'K'; - q = (boards[move][CASTLING][1] == BOARD_LEFT && + q = (boards[move][CASTLING][1] != NoRights && boards[move][CASTLING][2] != NoRights ); if(handW) { // for S-Chess with pieces in hand, list virgin pieces between K and Q for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q; i--) @@ -18018,9 +18018,9 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) } if(q) *p++ = 'Q'; k = 0; - if(boards[move][CASTLING][3] == BOARD_RGHT-1 && + if(boards[move][CASTLING][3] != NoRights && boards[move][CASTLING][5] != NoRights ) k = 1, *p++ = 'k'; - q = (boards[move][CASTLING][4] == BOARD_LEFT && + q = (boards[move][CASTLING][4] != NoRights && boards[move][CASTLING][5] != NoRights ); if(handB) { for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q; i--)