Fix time in PGN info
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 10 Jan 2011 19:36:48 +0000 (20:36 +0100)
committerArun Persaud <arun@nubati.net>
Tue, 11 Jan 2011 05:22:05 +0000 (21:22 -0800)
Saving of the thinking time in the PGN was broken by the patch that
removed the race condition in the clock switching, because that moved
the incrementing of forwardMostMove to behind the code that used fmm to
index pvInfoList. As a result the time was stored in the slot for the
opponent's previous move. The value is corrected now.

backend.c

index 9629342..5224018 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -14545,15 +14545,15 @@ SwitchClocks(int newMoveNr)
            if(blackNPS >= 0) lastTickLength = 0;
            blackTimeRemaining -= lastTickLength;
            /* [HGM] PGNtime: save time for PGN file if engine did not give it */
-//         if(pvInfoList[forwardMostMove-1].time == -1)
-                 pvInfoList[forwardMostMove-1].time =               // use GUI time
+//         if(pvInfoList[forwardMostMove].time == -1)
+                 pvInfoList[forwardMostMove].time =               // use GUI time
                       (timeRemaining[1][forwardMostMove-1] - blackTimeRemaining)/10;
        } else {
           if(whiteNPS >= 0) lastTickLength = 0;
           whiteTimeRemaining -= lastTickLength;
            /* [HGM] PGNtime: save time for PGN file if engine did not give it */
-//         if(pvInfoList[forwardMostMove-1].time == -1)
-                 pvInfoList[forwardMostMove-1].time =
+//         if(pvInfoList[forwardMostMove].time == -1)
+                 pvInfoList[forwardMostMove].time =
                       (timeRemaining[0][forwardMostMove-1] - whiteTimeRemaining)/10;
        }
        flagged = CheckFlags();