X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=moves.c;h=dbc8f41d47604b336834385fc7e1820003ab7ea7;hb=3808a80498c0347b4ad4c52c4c1d7e93bcf57c1f;hp=b4edc45497ff06a83d018dfce5570c7746ca7325;hpb=cfafc82a47f718181d7de520fd7616156a647656;p=xboard.git diff --git a/moves.c b/moves.c index b4edc45..dbc8f41 100644 --- a/moves.c +++ b/moves.c @@ -433,10 +433,20 @@ 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 || vx < 0 && board[y][x-1] == DarkSquare) && 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 + if(pc != WhiteKing && pc != BlackKing) { // non-royal castling (to be entered as two-leg move via 'Rook') + if(killX < 0) cb(board, flags, FirstLeg, r, f, y, x, cl); + legNr <<= 1; cb(board, flags, NormalMove, r, f, y, f - expo, cl); legNr >>= 1; + } else cb(board, flags, mine == 1 ? WhiteQueenSideCastle : BlackQueenSideCastle, r, f, y, f - expo, cl); - if((x == BOARD_RGHT-1 || vx > 0 && board[y][x+1] == DarkSquare) && board[y][x] == initialPosition[y][x]) + } + if((x == BOARD_RGHT-1 || vx > 0 && board[y][x+1] == DarkSquare) && board[y][x] == initialPosition[y][x]) { + if(pc != WhiteKing && pc != BlackKing) { + if(killX < 0) cb(board, flags, FirstLeg, r, f, y, x, cl); + legNr <<= 1; cb(board, flags, NormalMove, r, f, y, f + expo, cl); legNr >>= 1; + } else cb(board, flags, mine == 1 ? WhiteKingSideCastle : BlackKingSideCastle, r, f, y, f + expo, cl); + } break; } if(mode & 16 && (board[y][x] == WhiteKing || board[y][x] == BlackKing)) break; // tame piece, cannot capture royal