Fix Seirawan reverse-castling animation
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 2 Feb 2014 09:40:18 +0000 (10:40 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 2 Feb 2014 09:40:18 +0000 (10:40 +0100)
In Chess960 animation of castlings is suppressed, because the move is encoded
as KxR, so that the to-square in general is not the final destination of the
King. So it is just confusing to the eye to see the King slide to the Rook,
and then jump to an entirely different square. In S-Chess castlings can
similarly be encoded as RxK (to indicate gating at the Rook square), and
animation of those moves should be suppressed for the same reason. But it
wasn't, and in Fischer castlings denoted as RxK this even caused the Rook
to disappear when it didn't need to moved.
 Perhaps one day a smart method of animating Fischer castlings can be
designed. (E.g. remove Rook, animate King move to true to-square, place Rook?
But what if the King doesn't move at all? Animate Rook then? Normal castlings
now animate the King, and then just displace the Rook.)

board.c

diff --git a/board.c b/board.c
index abd2a68..d0f6cfb 100644 (file)
--- a/board.c
+++ b/board.c
@@ -611,7 +611,9 @@ AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
     return;
 
   if(board[toY][toX] == WhiteRook && board[fromY][fromX] == WhiteKing ||
-     board[toY][toX] == BlackRook && board[fromY][fromX] == BlackKing)
+     board[toY][toX] == BlackRook && board[fromY][fromX] == BlackKing ||
+     board[toY][toX] == WhiteKing && board[fromY][fromX] == WhiteRook || // [HGM] seirawan
+     board[toY][toX] == BlackKing && board[fromY][fromX] == BlackRook)
        return; // [HGM] FRC: no animtion of FRC castlings, as to-square is not true to-square
 
   if (fromY < 0 || fromX < 0 || toX < 0 || toY < 0) return;