From: H.G. Muller Date: Wed, 6 Jan 2010 23:25:57 +0000 (+0100) Subject: Fix castling rule assignment in shuffle games X-Git-Tag: hgm-4.20100107~12 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=9eb6760c0c2816e3966db9e3bcbf83ce93fcf009 Fix castling rule assignment in shuffle games The conversion to in-board storage for rights copied directly to boards[0] in steadof initialPosition, and was then overwritten when the latter was copied with uninitialized rights to boards[0]. This affected FRC and CRC, where rights are non-standard. --- diff --git a/backend.c b/backend.c index bffcdaf..d062185 100644 --- a/backend.c +++ b/backend.c @@ -4518,12 +4518,12 @@ void SetUpShuffle(Board board, int number) // Last King gets castling rights while(piecesLeft[(int)WhiteUnicorn]) { i = put(board, WhiteUnicorn, 0, piecesLeft[(int)WhiteRook]/2, ANY); - initialRights[2] = initialRights[5] = boards[0][CASTLING][2] = boards[0][CASTLING][5] = i; + initialRights[2] = initialRights[5] = board[CASTLING][2] = board[CASTLING][5] = i; } while(piecesLeft[(int)WhiteKing]) { i = put(board, WhiteKing, 0, piecesLeft[(int)WhiteRook]/2, ANY); - initialRights[2] = initialRights[5] = boards[0][CASTLING][2] = boards[0][CASTLING][5] = i; + initialRights[2] = initialRights[5] = board[CASTLING][2] = board[CASTLING][5] = i; } @@ -4538,9 +4538,9 @@ void SetUpShuffle(Board board, int number) if(PosFlags(0) & F_FRC_TYPE_CASTLING) { // first and last Rook get FRC castling rights if(first) { first=0; - initialRights[1] = initialRights[4] = boards[0][CASTLING][1] = boards[0][CASTLING][4] = i; + initialRights[1] = initialRights[4] = board[CASTLING][1] = board[CASTLING][4] = i; } - initialRights[0] = initialRights[3] = boards[0][CASTLING][0] = boards[0][CASTLING][3] = i; + initialRights[0] = initialRights[3] = board[CASTLING][0] = board[CASTLING][3] = i; } } for(i=BOARD_LEFT; i