- if (!appData.highlightLastMove) {\r
- ClearHighlights();\r
- DrawPosition((int) (forceFullRepaint || FALSE), NULL);\r
- }\r
- fromX = fromY = -1;\r
- dragInfo.start.x = dragInfo.start.y = -1;\r
- dragInfo.from = dragInfo.start;\r
- break;\r
- } else if (x < 0 || y < 0\r
- /* [HGM] block clicks between board and holdings */\r
- || x == BOARD_LEFT-1 || x == BOARD_RGHT\r
- || (x == BOARD_LEFT-2 && y < BOARD_HEIGHT-gameInfo.holdingsSize)\r
- || (x == BOARD_RGHT+1 && y >= gameInfo.holdingsSize)\r
- /* EditPosition, empty square, or different color piece;\r
- click-click move is possible */\r
- ) {\r
- break;\r
- } else if (fromX == x && fromY == y) {\r
- /* Downclick on same square again */\r
- ClearHighlights();\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
- sameAgain = TRUE;\r
- } else if (fromX != -1 &&\r
- x != BOARD_LEFT-2 && x != BOARD_RGHT+1\r
- ) {\r
- /* Downclick on different square. */\r
- /* [HGM] if on holdings file, should count as new first click ! */\r
- /* [HGM] <sameColor> now always do UserMoveTest(), and check colors there */\r
- toX = x;\r
- toY = y;\r
- /* [HGM] <popupFix> UserMoveEvent requires two calls now,\r
- to make sure move is legal before showing promotion popup */\r
- moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR, FALSE);\r
- if(moveType == AmbiguousMove) { /* [HGM] Edit-Position move executed */\r
- fromX = fromY = -1;\r
- ClearHighlights();\r
- DrawPosition(FALSE, boards[currentMove]);\r
- break;\r
- } else\r
- if(moveType != ImpossibleMove && moveType != Comment) {\r
- /* [HGM] We use PromotionToKnight in Shogi to indicate frorced promotion */\r
- if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight ||\r
- ((moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) &&\r
- appData.alwaysPromoteToQueen)) {\r
- FinishMove(moveType, fromX, fromY, toX, toY, 'q');\r
- if (!appData.highlightLastMove) {\r
- ClearHighlights();\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
- }\r
- } else\r
- if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) {\r
- SetHighlights(fromX, fromY, toX, toY);\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
- /* [HGM] <popupFix> Popup calls FinishMove now.\r
- If promotion to Q is legal, all are legal! */\r
- if(gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)\r
- { ChessSquare p = boards[currentMove][fromY][fromX], q = boards[currentMove][toY][toX];\r
- // kludge to temporarily execute move on display, without promoting yet\r
- promotionChoice = TRUE;\r
- boards[currentMove][fromY][fromX] = EmptySquare; // move Pawn to 8th rank\r
- boards[currentMove][toY][toX] = p;\r
- DrawPosition(FALSE, boards[currentMove]);\r
- boards[currentMove][fromY][fromX] = p; // take back, but display stays\r
- boards[currentMove][toY][toX] = q;\r
- DisplayMessage("Select piece from holdings", "");\r
- } else\r
- PromotionPopup(hwnd);\r
- goto noClear;\r
- } else { // not a promotion. Move can be illegal if testLegality off, and should be made then.\r
- if (appData.animate || appData.highlightLastMove) {\r
- SetHighlights(fromX, fromY, toX, toY);\r
- } else {\r
- ClearHighlights();\r
- }\r
- FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR);\r
- if (appData.animate && !appData.highlightLastMove) {\r
- ClearHighlights();\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
- }\r
- }\r
- fromX = fromY = -1;\r
- noClear:\r
- break;\r
- }\r
- if (gotPremove && moveType != Comment) {\r
- SetPremoveHighlights(fromX, fromY, toX, toY);\r
-// DrawPosition(forceFullRepaint || FALSE, NULL);\r
- } else ClearHighlights();\r
- fromX = fromY = -1;\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
- if(moveType != Comment) break;\r
- }\r
- /* First downclick, or restart on a square with same color piece */\r
- if (!frozen && OKToStartUserMove(x, y)) {\r
- fromX = x;\r
- fromY = y;\r
- dragInfo.lastpos = pt;\r
- dragInfo.from.x = fromX;\r
- dragInfo.from.y = fromY;\r
- dragInfo.start = dragInfo.from;\r
- SetCapture(hwndMain);\r
- } else {\r
- fromX = fromY = -1;\r