From: H.G.Muller Date: Sun, 28 Feb 2016 10:34:52 +0000 (+0100) Subject: Fix bug #43792 (no highlights after rejection of premove) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=57bd3f69d6723a8932a6131b7aee7042cfd91ee0;p=xboard.git Fix bug #43792 (no highlights after rejection of premove) If the sending of a premove fails to add a move to the game, because XBoard itself judges the move illegal (which could only be determined after arrival of the opponent move, not when it was entered), XBoard now re-applies the move highlights for that opponent move. This does not solve the problem yet with legality testing off, when it later turns out the ICS rejects the move. --- diff --git a/backend.c b/backend.c index 36131f6..0624dac 100644 --- a/backend.c +++ b/backend.c @@ -4162,6 +4162,7 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int fprintf(debugFP, "Sending premove:\n"); SendToICS(str); } else if (gotPremove) { + int oldFMM = forwardMostMove; gotPremove = 0; ClearPremoveHighlights(); if (appData.debugMode) @@ -4169,6 +4170,13 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int UserMoveEvent(premoveFromX, premoveFromY, premoveToX, premoveToY, premovePromoChar); + if(forwardMostMove == oldFMM) { // premove was rejected, highlight last opponent move + if(moveList[oldFMM-1][1] != '@') + SetHighlights(moveList[oldFMM-1][0]-AAA, moveList[oldFMM-1][1]-ONE, + moveList[oldFMM-1][2]-AAA, moveList[oldFMM-1][3]-ONE); + else // (drop) + SetHighlights(-1, -1, moveList[oldFMM-1][2]-AAA, moveList[oldFMM-1][3]-ONE); + } } } @@ -6959,7 +6967,7 @@ int doubleClick; Boolean addToBookFlag; void -UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar) +UserMoveEvent (int fromX, int fromY, int toX, int toY, int promoChar) { ChessMove moveType; ChessSquare pup;