From 0560406e1440775b2158051b2c13324e5be7ee78 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 25 Nov 2016 22:59:35 +0100 Subject: [PATCH] Fix bug in storing time of first move TwoMachinesEvent() reset the clocks for re-calculating time odds (as the first engine would play white, while any previous Reset() would have assumed it played black). But it did not save the start time in the tmeReamaining array. Actually TwoMachinesEvent() was not supposed to unconditionally reset the clocks, and this bug was introduced when the ResetClocks was moved out of the conditional, separating it from saving the start times. It is nowput back inside the conditional, but the condition is now also incorporating the case TwoMachineEvent() was called at the start of a game (i.e. no moves done). When used to resume a game in progress it keeps the existing clocks (except for engines that do not support time/otim). --- backend.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index c3a68e7..196b8a0 100644 --- a/backend.c +++ b/backend.c @@ -15032,7 +15032,7 @@ WaitForEngine (ChessProgramState *cps, DelayedEventCallback retry) void TwoMachinesEvent P((void)) { - int i; + int i, move = forwardMostMove; char buf[MSG_SIZ]; ChessProgramState *onmove; char *bookHit = NULL; @@ -15149,8 +15149,8 @@ TwoMachinesEvent P((void)) } } - ResetClocks(); - if (!first.sendTime || !second.sendTime) { + if (!first.sendTime || !second.sendTime || move == 0) { // [HGM] first engine changed sides from Reset, so recalc time odds + ResetClocks(); timeRemaining[0][forwardMostMove] = whiteTimeRemaining; timeRemaining[1][forwardMostMove] = blackTimeRemaining; } -- 1.7.0.4