From 52200167cf575a4b1a3101d17f540de644e76558 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 28 Jan 2016 17:55:15 +0100 Subject: [PATCH] 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. --- backend.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) 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 || -- 1.7.0.4