fix premove for winboard
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 23 Aug 2009 00:30:05 +0000 (17:30 -0700)
committerArun Persaud <arun@nubati.net>
Sun, 23 Aug 2009 00:30:05 +0000 (17:30 -0700)
This might fix the illusive premove problem. In 4.2.7 the code was not properly
indented, and this led to an unbalanced braces error that I then fixed the
wrong way.
Click-click premoves did only work after clicking the toSquare twice. It
might be
that they actually did work after clicking it once, but that the highlights
were not
displayed (although set) for lack of a display refresh.

winboard/winboard.c

index 21d731d..a17e4ac 100644 (file)
@@ -5140,23 +5140,20 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                  ClearHighlights();\r
              }\r
              FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR);\r
-            fromX = fromY = -1;\r
              if (appData.animate && !appData.highlightLastMove) {\r
                   ClearHighlights();\r
                   DrawPosition(forceFullRepaint || FALSE, NULL);\r
              }\r
           }\r
-          break;\r
+          fromX = fromY = -1;\r
+         break;\r
         }\r
         if (gotPremove) {\r
-            /* [HGM] it seemed that braces were missing here */\r
-            SetPremoveHighlights(fromX, fromY, toX, toY);\r
-            fromX = fromY = -1;\r
-            break;\r
-        }\r
-      }\r
-      ClearHighlights();\r
-      DrawPosition(forceFullRepaint || FALSE, NULL);\r
+           SetPremoveHighlights(fromX, fromY, toX, toY);\r
+            DrawPosition(forceFullRepaint || FALSE, NULL);\r
+       } else ClearHighlights();\r
+        fromX = fromY = -1;\r
+        DrawPosition(forceFullRepaint || FALSE, NULL);\r
     }\r
     /* First downclick, or restart on a square with same color piece */\r
     if (!frozen && OKToStartUserMove(x, y)) {\r