X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=3eea34d3a6e3d4ec8f18f81a49bea9c6059d0b7e;hb=eca6bb833394a9a378dd209cefb2c1a5e721f2a9;hp=b2cd7c3c42c998220e3cb2db062a1b9565dc5293;hpb=e4def842c0f4ed63df0196ac34ffdeb6a12304fe;p=xboard.git diff --git a/backend.c b/backend.c index b2cd7c3..3eea34d 100644 --- a/backend.c +++ b/backend.c @@ -387,7 +387,7 @@ u64ToDouble (u64 value) by this function. */ int -PosFlags (index) +PosFlags (int index) { int flags = F_ALL_CASTLE_OK; if ((index % 2) == 0) flags |= F_WHITE_ON_MOVE; @@ -7431,7 +7431,7 @@ MarkTargetSquares (int clear) if(clear) { // no reason to ever suppress clearing for(x=0; x= 0) { @@ -7678,7 +7680,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) doubleClick = first.excludeMoves; // used by UserMoveEvent to recognize exclude moves } promoDefaultAltered = FALSE; - MarkTargetSquares(1); + if(!second) MarkTargetSquares(1); if(!(second && appData.oneClick && OnlyMove(&x, &y, TRUE))) { if (appData.highlightDragging) { SetHighlights(x, y, -1, -1); @@ -7735,10 +7737,11 @@ LeftClick (ClickType clickType, int xPix, int yPix) second = 0; fromX = fromY = -1; gatingPiece = EmptySquare; - MarkTargetSquares(1); ClearHighlights(); gotPremove = 0; ClearPremoveHighlights(); + MarkTargetSquares(-1); + DrawPosition(FALSE, NULL); // make user highlights are drawn (and deferred marker clearing) } else { /* First upclick in same square; start click-click mode */ SetHighlights(x, y, -1, -1); @@ -7787,6 +7790,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) if(gameInfo.variant != VariantChuChess && PieceToChar(CHUPROMOTED(piece)) == '+') promoSweep = CHUPROMOTED(piece); selectFlag = 0; lastX = xPix; lastY = yPix; ReportClick("put", x, y); // extra put to prompt engine for 'choice' command + saveFlash = appData.flashCount; appData.flashCount = 0; Sweep(0); // Pawn that is going to promote: preview promotion piece sweepSelecting = 1; DisplayMessage("", _("Pull pawn backwards to under-promote")); @@ -7800,14 +7804,16 @@ LeftClick (ClickType clickType, int xPix, int yPix) } else { ClearHighlights(); } + MarkTargetSquares(1); } else if(sweepSelecting) { // this must be the up-click corresponding to the down-click that started the sweep sweepSelecting = 0; appData.animate = FALSE; // do not animate, a selected piece already on to-square - *promoRestrict = 0; + *promoRestrict = 0; appData.flashCount = saveFlash; if (appData.animate || appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); } else { ClearHighlights(); } + MarkTargetSquares(1); } else { #if 0 // [HGM] this must be done after the move is made, as with arrow it could lead to a board redraw with piece still on from square @@ -7837,6 +7843,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) DragPieceEnd(xPix, yPix); dragging = 0; /* Don't animate move and drag both */ appData.animate = FALSE; + MarkTargetSquares(-1); // -1 defers displaying marker change to prevent piece reappearing on from-square! } // moves into holding are invalid for now (except in EditPosition, adapting to-square) @@ -7894,19 +7901,20 @@ LeftClick (ClickType clickType, int xPix, int yPix) PromotionPopUp(promoChoice); } else { int oldMove = currentMove; + flashing = 1; // prevent recursive calling (by release of to-click) while flashing piece UserMoveEvent(fromX, fromY, toX, toY, promoChoice); if (!appData.highlightLastMove || gotPremove) ClearHighlights(); if (gotPremove) SetPremoveHighlights(fromX, fromY, toX, toY); if(saveAnimate && !appData.animate && currentMove != oldMove && // drag-move was performed Explode(boards[currentMove-1], fromX, fromY, toX, toY)) DrawPosition(TRUE, boards[currentMove]); - MarkTargetSquares(1); fromX = fromY = -1; + flashing = 0; } appData.animate = saveAnimate; if (appData.animate || appData.animateDragging) { /* Undo animation damage if needed */ - DrawPosition(FALSE, NULL); +// DrawPosition(FALSE, NULL); } } @@ -12089,21 +12097,17 @@ AutoPlayOneMove () SetHighlights(-1, -1, toX, toY); } } else { - int viaX = moveList[currentMove][5] - AAA; - int viaY = moveList[currentMove][6] - ONE; fromX = moveList[currentMove][0] - AAA; fromY = moveList[currentMove][1] - ONE; HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove); /* [AS] */ if(moveList[currentMove][4] == ';') { // multi-leg - ChessSquare piece = boards[currentMove][viaY][viaX]; - AnimateMove(boards[currentMove], fromX, fromY, viaX, viaY); - boards[currentMove][viaY][viaX] = boards[currentMove][fromY][fromX]; - AnimateMove(boards[currentMove], fromX=viaX, fromY=viaY, toX, toY); - boards[currentMove][viaY][viaX] = piece; - } else + killX = moveList[currentMove][5] - AAA; + killY = moveList[currentMove][6] - ONE; + } AnimateMove(boards[currentMove], fromX, fromY, toX, toY); + killX = killY = -1; if (appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); @@ -15860,19 +15864,15 @@ ForwardInner (int target) SetHighlights(-1, -1, toX, toY); } } else { - int viaX = moveList[target - 1][5] - AAA; - int viaY = moveList[target - 1][6] - ONE; fromX = moveList[target - 1][0] - AAA; fromY = moveList[target - 1][1] - ONE; if (target == currentMove + 1) { if(moveList[target - 1][4] == ';') { // multi-leg - ChessSquare piece = boards[currentMove][viaY][viaX]; - AnimateMove(boards[currentMove], fromX, fromY, viaX, viaY); - boards[currentMove][viaY][viaX] = boards[currentMove][fromY][fromX]; - AnimateMove(boards[currentMove], viaX, viaY, toX, toY); - boards[currentMove][viaY][viaX] = piece; - } else + killX = moveList[target - 1][5] - AAA; + killY = moveList[target - 1][6] - ONE; + } AnimateMove(boards[currentMove], fromX, fromY, toX, toY); + killX = killY = -1; } if (appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY);