From 34c0d135d701dbb3e5c3c2298fcb0db8e77bebef Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 31 Oct 2014 14:26:19 +0100 Subject: [PATCH] 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. --- moves.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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; } -- 1.7.0.4