Improve triple-leg-move animation
[xboard.git] / board.c
diff --git a/board.c b/board.c
index f2b0643..9bce22f 100644 (file)
--- a/board.c
+++ b/board.c
@@ -5,7 +5,8 @@
  * Massachusetts.
  *
  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
+ * Software Foundation, Inc.
  *
  * The following terms apply to Digital Equipment Corporation's copyright
  * interest in XBoard:
@@ -599,7 +600,7 @@ void
 AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
 {
   ChessSquare piece;
-  int hop, x = toX, y = toY;
+  int hop, x = toX, y = toY, x2 = kill2X;
   Pnt      start, finish, mid;
   Pnt      frames[kFactor * 2 + 1];
   int        nFrames, startColor, endColor;
@@ -620,6 +621,7 @@ AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
   piece = board[fromY][fromX];
   if (piece >= EmptySquare) return;
 
+  if(x2 >= 0) toX = kill2X, toY = kill2Y; else
   if(killX >= 0) toX = killX, toY = killY; // [HGM] lion: first to kill square
 
 again:
@@ -662,6 +664,7 @@ again:
   /* Be sure end square is redrawn */
   damage[0][toY][toX] |= True;
 
+  if(toX == x2 && toY == kill2Y) { fromX = toX; fromY = toY; toX = killX; toY = killY; x2 = -1; goto again; } // second leg
   if(toX != x || toY != y) { fromX = toX; fromY = toY; toX = x; toY = y; goto again; } // second leg
 }