From feb9ffa5813080ac135862a2972cd80508e67569 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Mon, 21 Sep 2020 17:22:13 +0200 Subject: [PATCH] Fix move time for CECP Ensure full usage of time specified by `st`. --- src/xboard.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xboard.cpp b/src/xboard.cpp index b360db2d5..c4f9c1d5f 100644 --- a/src/xboard.cpp +++ b/src/xboard.cpp @@ -221,17 +221,22 @@ void StateMachine::process_command(Position& pos, std::string token, std::istrin { is >> num; limits.movetime = num * 1000; + limits.time[WHITE] = limits.time[BLACK] = 0; } // Note: time/otim are in centi-, not milliseconds else if (token == "time") { is >> num; - limits.time[playColor != COLOR_NB ? playColor : pos.side_to_move()] = num * 10; + Color us = playColor != COLOR_NB ? playColor : pos.side_to_move(); + if (limits.time[us]) + limits.time[us] = num * 10; } else if (token == "otim") { is >> num; - limits.time[playColor != COLOR_NB ? ~playColor : ~pos.side_to_move()] = num * 10; + Color them = playColor != COLOR_NB ? ~playColor : ~pos.side_to_move(); + if (limits.time[them]) + limits.time[them] = num * 10; } } else if (token == "setboard")