The erasing of target-square markers could lead to flashing of the
moved piece. It was also ugly when the piece was slipped under a marker.
The actual display of the marker change on erasing can now be deferred
to a later position draw, and this is used when erasing after a drag-drop
move to do it after the move was accepted (so the piece would not be
flashed on the from-square, but still displayed without marker on it
after the drop). For click-click the erasure is shown before animation
starts. A problem with showing deselection when target-square marking
was off is now also fixed.
if(clear) { // no reason to ever suppress clearing
for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) sum += marker[y][x], marker[y][x] = 0;
hoverSavedValid = 0;
if(clear) { // no reason to ever suppress clearing
for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) sum += marker[y][x], marker[y][x] = 0;
hoverSavedValid = 0;
- if(!sum) return; // nothing was cleared,no redraw needed
+ if(!sum || clear < 0) return; // nothing was cleared,no redraw needed
} else {
int capt = 0;
if(!appData.markers || !appData.highlightDragging || appData.icsActive && gameInfo.variant < VariantShogi ||
} else {
int capt = 0;
if(!appData.markers || !appData.highlightDragging || appData.icsActive && gameInfo.variant < VariantShogi ||
doubleClick = first.excludeMoves; // used by UserMoveEvent to recognize exclude moves
}
promoDefaultAltered = FALSE;
doubleClick = first.excludeMoves; // used by UserMoveEvent to recognize exclude moves
}
promoDefaultAltered = FALSE;
+ if(!second) MarkTargetSquares(1);
if(!(second && appData.oneClick && OnlyMove(&x, &y, TRUE))) {
if (appData.highlightDragging) {
SetHighlights(x, y, -1, -1);
if(!(second && appData.oneClick && OnlyMove(&x, &y, TRUE))) {
if (appData.highlightDragging) {
SetHighlights(x, y, -1, -1);
second = 0;
fromX = fromY = -1;
gatingPiece = EmptySquare;
second = 0;
fromX = fromY = -1;
gatingPiece = EmptySquare;
ClearHighlights();
gotPremove = 0;
ClearPremoveHighlights();
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);
} else {
/* First upclick in same square; start click-click mode */
SetHighlights(x, y, -1, -1);
} else {
ClearHighlights();
}
} else {
ClearHighlights();
}
} 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;
} 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;
} else {
ClearHighlights();
}
} else {
ClearHighlights();
}
} 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
} 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
DragPieceEnd(xPix, yPix); dragging = 0;
/* Don't animate move and drag both */
appData.animate = FALSE;
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)
}
// moves into holding are invalid for now (except in EditPosition, adapting to-square)
if(saveAnimate && !appData.animate && currentMove != oldMove && // drag-move was performed
Explode(boards[currentMove-1], fromX, fromY, toX, toY))
DrawPosition(TRUE, boards[currentMove]);
if(saveAnimate && !appData.animate && currentMove != oldMove && // drag-move was performed
Explode(boards[currentMove-1], fromX, fromY, toX, toY))
DrawPosition(TRUE, boards[currentMove]);
fromX = fromY = -1;
}
appData.animate = saveAnimate;
if (appData.animate || appData.animateDragging) {
/* Undo animation damage if needed */
fromX = fromY = -1;
}
appData.animate = saveAnimate;
if (appData.animate || appData.animateDragging) {
/* Undo animation damage if needed */
- DrawPosition(FALSE, NULL);
+// DrawPosition(FALSE, NULL);