Update zh_CN.po translation
[xboard.git] / board.c
diff --git a/board.c b/board.c
index f0cb1c6..a368356 100644 (file)
--- a/board.c
+++ b/board.c
@@ -600,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;
@@ -621,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:
@@ -663,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
 }
 
@@ -917,10 +919,12 @@ DrawPosition (int repaint, Board board)
     static int lastFlipView = 0;
     static int lastBoardValid[2] = {0, 0};
     static Board lastBoard[2];
-    static char lastMarker[BOARD_RANKS][BOARD_FILES];
+    static char lastMarker[BOARD_RANKS][BOARD_FILES], messedUp;
     int rrow, rcol;
     int nr = twoBoards*partnerUp;
 
+    repaint |= messedUp;
+
     if(DrawSeekGraph()) return; // [HGM] seekgraph: suppress any drawing if seek graph up
 
     if (board == NULL) {
@@ -1048,6 +1052,17 @@ DrawPosition (int repaint, Board board)
 
     FlashDelay(0); // this flushes drawing queue;
     if(nr) SwitchWindow(1);
+    else {
+       TimeMark now;
+       GetTimeMark(&now);
+       if(SubtractTimeMarks(&now, &programStartTime) < 1000) {
+           DrawSeekBackground(2*squareSize, 3*squareSize, 6*squareSize, 5*squareSize);
+           DrawText("Right-clicking dialog texts", 2*squareSize + 5, 3*squareSize + 5, 2);
+           DrawText("pops up help on them", 2*squareSize + 5, (int) (3.3*squareSize) + 5, 2);
+           GraphExpose(currBoard, 2*squareSize, 3*squareSize, 4*squareSize, 2*squareSize);
+           messedUp = TRUE;
+       } else messedUp = FALSE;
+    }
 }
 
 /* [AS] Arrow highlighting support */
@@ -1188,13 +1203,20 @@ DrawArrowBetweenPoints (int s_x, int s_y, int d_x, int d_y)
 static void
 ArrowDamage (int s_col, int s_row, int d_col, int d_row)
 {
-    int hor, vert, i, n = partnerUp * twoBoards;
-    hor = 64*s_col + 32; vert = 64*s_row + 32;
+    int hor, vert, i, n = partnerUp * twoBoards, delta = abs(d_row - s_row);
+
+    if( 2*(d_row - s_row) > abs(d_col - s_col) ) d_row = 4*d_row + 1; else 
+    if( 2*(s_row - d_row) > abs(d_col - s_col) ) d_row = 4*d_row + 3; else d_row = 4*d_row + 2;
+    if( 2*(d_col - s_col) > delta ) d_col = 4*d_col + 1; else 
+    if( 2*(s_col - d_col) > delta ) d_col = 4*d_col + 3; else d_col = 4*d_col + 2;
+    s_row = 4*s_row + 2; s_col = 4*s_col + 2;
+
+    hor = 64*s_col; vert = 64*s_row;
     for(i=0; i<= 64; i++) {
-            damage[n][vert+8>>6][hor+8>>6] |= 2;
-            damage[n][vert-8>>6][hor+8>>6] |= 2;
-            damage[n][vert+8>>6][hor-8>>6] |= 2;
-            damage[n][vert-8>>6][hor-8>>6] |= 2;
+            damage[n][vert+30>>8][hor+30>>8] |= 2;
+            damage[n][vert-30>>8][hor+30>>8] |= 2;
+            damage[n][vert+30>>8][hor-30>>8] |= 2;
+            damage[n][vert-30>>8][hor-30>>8] |= 2;
             hor += d_col - s_col; vert += d_row - s_row;
     }
 }
@@ -1203,7 +1225,7 @@ ArrowDamage (int s_col, int s_row, int d_col, int d_row)
 static void
 DrawArrowBetweenSquares (int s_col, int s_row, int d_col, int d_row)
 {
-    int s_x, s_y, d_x, d_y;
+    int s_x, s_y, d_x, d_y, delta_y;
 
     if( s_col == d_col && s_row == d_row ) {
         return;
@@ -1212,21 +1234,22 @@ DrawArrowBetweenSquares (int s_col, int s_row, int d_col, int d_row)
     /* Get source and destination points */
     SquareToPos( s_row, s_col, &s_x, &s_y);
     SquareToPos( d_row, d_col, &d_x, &d_y);
+    delta_y = abs(d_y - s_y);
 
-    if( d_y > s_y && d_y - s_y > abs(d_x - s_x)/2) {
+    if( d_y > s_y && 2*(d_y - s_y) > abs(d_x - s_x)) {
         d_y += squareSize / 2 - squareSize / 4; // [HGM] round towards same centers on all sides!
     }
-    else if( d_y < s_y && s_y - d_y > abs(d_x - d_y)/2) {
+    else if( d_y < s_y && 2*(s_y - d_y) > abs(d_x - s_x)) {
         d_y += squareSize / 2 + squareSize / 4;
     }
     else {
         d_y += squareSize / 2;
     }
 
-    if( d_x > s_x && d_x - s_x > abs(d_y - s_y)/2) {
+    if( d_x > s_x && 2*(d_x - s_x) > delta_y) {
         d_x += squareSize / 2 - squareSize / 4;
     }
-    else if( d_x < s_x && s_x - d_x > abs(d_y - s_y)/2) {
+    else if( d_x < s_x && 2*(s_x - d_x) > delta_y) {
         d_x += squareSize / 2 + squareSize / 4;
     }
     else {