From c5dcdc1244715170a3837053879655dcadb524da Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 18 Feb 2010 17:41:10 +0100 Subject: [PATCH] Handle display of PV that starts with other move than played Insert the retraction of the played move, without premove highlighting. --- backend.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/backend.c b/backend.c index 90b9269..449157d 100644 --- a/backend.c +++ b/backend.c @@ -4753,6 +4753,20 @@ fprintf(debugFP,"parsePV: %d %c%c%c%c '%s'\n", valid, fromX+AAA, fromY+ONE, toX+ if(!valid && nr == 0 && ParseOneMove(pv, endPV-1, &moveType, &fromX, &fromY, &toX, &toY, &promoChar)){ nr++; moveType = Comment; // First move has been played; kludge to make sure we continue + // Hande case where played move is different from leading PV move + CopyBoard(boards[endPV+1], boards[endPV-1]); // tentatively unplay last game move + CopyBoard(boards[endPV+2], boards[endPV-1]); // and play first move of PV + ApplyMove(fromX, fromY, toX, toY, promoChar, boards[endPV+2]); + if(!CompareBoards(boards[endPV], boards[endPV+2])) { + endPV += 2; // if position different, keep this + moveList[endPV-1][0] = fromX + AAA; + moveList[endPV-1][1] = fromY + ONE; + moveList[endPV-1][2] = toX + AAA; + moveList[endPV-1][3] = toY + ONE; + parseList[endPV-1][0] = NULLCHAR; + strcpy(moveList[endPV-2], "_0_0"); // suppress premove highlight on takeback move + } + } } while(*pv && *pv++ != ' '); // skip what we parsed; assume space separators if(moveType == Comment) { valid++; continue; } // allow comments in PV -- 1.7.0.4