From: H.G.Muller Date: Thu, 28 Jan 2016 16:55:15 +0000 (+0100) Subject: Make move to own piece a swap rather than capture X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=52200167cf575a4b1a3101d17f540de644e76558;p=xboard.git Make move to own piece a swap rather than capture This is useful for Tamerlane Chess, where you can one time during the game have your King swap places with a friendly piece. --- diff --git a/backend.c b/backend.c index 8831176..f10b4a0 100644 --- a/backend.c +++ b/backend.c @@ -10147,6 +10147,11 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[toY][toX + (killX < fromX ? 1 : -1)] = killed; board[EP_STATUS] = EP_NONE; // capture was fake! } else + if(nrCastlingRights == 0 && board[toY][toX] < EmptySquare && (piece < BlackPawn) == (board[toY][toX] < BlackPawn)) { + board[fromY][fromX] = board[toY][toX]; // capture own will lead to swapping + board[toY][toX] = piece; + board[EP_STATUS] = EP_NONE; // capture was fake! + } else /* Code added by Tord: */ /* FRC castling assumed when king captures friendly rook. [HGM] or RxK for S-Chess */ if (board[fromY][fromX] == WhiteKing && board[toY][toX] == WhiteRook ||