X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=e7cf5b2447d78092445f6042279e8de8878ea54e;hb=a4dfbeaf8e977b278fe88a308068cf482e053a61;hp=f53847761a14c6d227b6e3bc79465a43df91741a;hpb=f6e0ba4110818a2785aa480eaa05836b742e9992;p=xboard.git diff --git a/backend.c b/backend.c index f538477..e7cf5b2 100644 --- a/backend.c +++ b/backend.c @@ -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); @@ -12924,7 +12928,7 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) char buf[MSG_SIZ]; int gn = gameNumber; ListGame *lg = NULL; - int numPGNTags = 0; + int numPGNTags = 0, i; int err, pos = -1; GameMode oldGameMode; VariantClass v, oldVariant = gameInfo.variant; /* [HGM] PGNvariant */ @@ -13113,6 +13117,8 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) if (appData.debugMode) fprintf(debugFP, "Parsed game start '%s' (%d)\n", yy_text, (int) cm); + for(i=0; i