From: H.G.Muller Date: Thu, 28 Jul 2016 12:24:27 +0000 (+0200) Subject: Defer book faking input move until ping balance X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=5297eb5a91178cf9a403da89709a4661efde0210 Defer book faking input move until ping balance The use of ping after editing a position had broken the book handling: 'go' would be sent in the same batch of commands as this 'ping', so that in case of a book hit the book move selected on behalf of the engine would be fed back to XBoard before the engine had the opportunity to restore the ping balanceby sending 'pong'. Now the book move is fed through ScheduleDelayedEvent(DeferredBookMove) rather than instantly, when a MachineWhite/BlackEvent sets the engine playing. --- diff --git a/backend.c b/backend.c index 5c37e3e..b288d6b 100644 --- a/backend.c +++ b/backend.c @@ -14877,7 +14877,9 @@ MachineWhiteEvent () safeStrCpy(bookMove, "move ", sizeof(bookMove)/sizeof(bookMove[0])); strcat(bookMove, bookHit); - HandleMachineMove(bookMove, &first); + savedMessage = bookMove; // args for deferred call + savedState = &first; + ScheduleDelayedEvent(DeferredBookMove, 1); } } @@ -14952,7 +14954,9 @@ MachineBlackEvent () safeStrCpy(bookMove, "move ", sizeof(bookMove)/sizeof(bookMove[0])); strcat(bookMove, bookHit); - HandleMachineMove(bookMove, &first); + savedMessage = bookMove; // args for deferred call + savedState = &first; + ScheduleDelayedEvent(DeferredBookMove, 1); } }