From: H.G.Muller Date: Fri, 26 Jan 2018 13:01:19 +0000 (+0100) Subject: Fix Edit Position with engine-defined variant X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d655d3bf4fcf38ba369fa700f3aa538d1ce85da0;p=xboard.git Fix Edit Position with engine-defined variant Submitting a new position starts a new game, but the position would be set up before the engine had the time to reply to the 'variant' command wit a 'setup'. As a consequence WinBoard would be unaware of the correct starting position, with as a consequence that Pawns might not be considered virgin for their Betza 'i' moves. Now even late reception of a 'setup' command from the engine when startedFromSetupPosition is true will cause initialPosition to be initialized. The assumption is that XBoard was already switched to the variant before, so that the 'setup' command is not needed for defining the pieceToCharTable used to interpret the FEN that set up the position. --- diff --git a/backend.c b/backend.c index c531656..e0f60b4 100644 --- a/backend.c +++ b/backend.c @@ -9257,6 +9257,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h NonStandardBoardSize(gameInfo.variant, gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize)) ) { // [HGM] allow first engine to define opening position int dummy, w, h, hand, s=6; char buf[MSG_SIZ], varName[MSG_SIZ]; + Board tmp; if(appData.icsActive || forwardMostMove != 0 || cps != &first) return; *buf = NULLCHAR; if(sscanf(message, "setup (%s", buf) == 1) { @@ -9277,10 +9278,11 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h startedFromSetupPosition = FALSE; } } - if(startedFromSetupPosition) return; + CopyBoard(tmp, boards[0]); ParseFEN(boards[0], &dummy, message+s, FALSE); - DrawPosition(TRUE, boards[0]); CopyBoard(initialPosition, boards[0]); + if(startedFromSetupPosition) { CopyBoard(boards[0], tmp); return; } + DrawPosition(TRUE, boards[0]); startedFromSetupPosition = TRUE; return; }