From: H.G.Muller Date: Fri, 31 Oct 2014 13:26:19 +0000 (+0100) Subject: Allow Betza castling with piece next to DarkSquare X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=34c0d135d701dbb3e5c3c2298fcb0db8e77bebef Allow Betza castling with piece next to DarkSquare In variants like Omega Chess the board edges are not really the first and last file, because of the Wizzard squares. So castling has to be allowed not only with the piece on those files, but also when the square beyond them is not part of the board anymore. --- diff --git a/moves.c b/moves.c index b6547cb..fa9a8cc 100644 --- a/moves.c +++ b/moves.c @@ -432,9 +432,9 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle if(mode & 1024) { // castling i = 2; // kludge to elongate move indefinitely if(occup == 4) continue; // skip empty squares - if(x == BOARD_LEFT && board[y][x] == initialPosition[y][x]) // reached initial corner piece + if((x == BOARD_LEFT || vx < 0 && board[y][x-1] == DarkSquare) && board[y][x] == initialPosition[y][x]) // reached initial corner piece cb(board, flags, mine == 1 ? WhiteQueenSideCastle : BlackQueenSideCastle, r, f, y, f - expo, cl); - if(x == BOARD_RGHT-1 && board[y][x] == initialPosition[y][x]) + if((x == BOARD_RGHT-1 || vx > 0 && board[y][x+1] == DarkSquare) && board[y][x] == initialPosition[y][x]) cb(board, flags, mine == 1 ? WhiteKingSideCastle : BlackKingSideCastle, r, f, y, f + expo, cl); break; }