POINT pos; /* window coordinates of current pos */\r
POINT lastpos; /* window coordinates of last pos - used for clipping */\r
POINT from; /* board coordinates of the piece's orig pos */\r
+ ChessSquare piece;\r
} DragInfo;\r
\r
-static DragInfo dragInfo = { {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1} };\r
+static DragInfo dragInfo = { {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, EmptySquare };\r
\r
typedef struct {\r
POINT sq[2]; /* board coordinates of from, to squares */\r
board[dragInfo.from.y][dragInfo.from.x] = dragged_piece;\r
x = dragInfo.pos.x - squareSize / 2;\r
y = dragInfo.pos.y - squareSize / 2;\r
- DrawPieceOnDC(hdcmem, dragged_piece,\r
- ((int) dragged_piece < (int) BlackPawn), \r
+ DrawPieceOnDC(hdcmem, dragInfo.piece,\r
+ ((int) dragInfo.piece < (int) BlackPawn), \r
(dragInfo.from.y + dragInfo.from.x) % 2, x, y, tmphdc);\r
} \r
\r
dragInfo.lastpos.y = boardRect.top + y;\r
dragInfo.from.x = fromX;\r
dragInfo.from.y = fromY;\r
+ dragInfo.piece = boards[currentMove][fromY][fromX];\r
dragInfo.start = dragInfo.from;\r
SetCapture(hwndMain);\r
}\r
dragInfo.pos = dragInfo.lastpos = dragInfo.start;\r
}\r
\r
+void ChangeDragPiece(ChessSquare piece)\r
+{\r
+ dragInfo.piece = piece;\r
+}\r
+\r
/* Event handler for mouse messages */\r
VOID\r
MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)\r
\r
case WM_MOUSEMOVE:\r
if(SeekGraphClick(Press, pt.x - boardRect.left, pt.y - boardRect.top, 1)) break;\r
+ if(PromoScroll(pt.x - boardRect.left, pt.y - boardRect.top)) break;\r
MovePV(pt.x - boardRect.left, pt.y - boardRect.top, boardRect.bottom - boardRect.top);\r
if ((appData.animateDragging || appData.highlightDragging)\r
&& (wParam & MK_LBUTTON)\r
if(gameMode != BeginningOfGame) { // allow menu item to remain enabled for better mode highligting\r
DisplayError(_("You can only start a match from the initial position."), 0); break;\r
}\r
- matchMode = 2;// distinguish from command-line-triggered case (matchMode=1)\r
- appData.matchGames = appData.defaultMatchGames;\r
- matchGame = 1;\r
- first.matchWins = second.matchWins = 0;\r
+ appData.matchGames = appData.defaultMatchGames;
+ MatchEvent(2); // distinguish from command-line-triggered case (matchMode=1)\r
+ break;\r
\r
case IDM_TwoMachines:\r
TwoMachinesEvent();\r