From: H.G. Muller Date: Mon, 17 Mar 2014 22:26:08 +0000 (+0100) Subject: Fix loading positions in engine-defined variant X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=cbe0a3b44b4bf242beaa7d398d40d4bedcbd6fff;p=xboard.git Fix loading positions in engine-defined variant Paste Position did not work when an engine-defined variant had redefined the pieceToCharTable, as the position would be interpreted and sent to the engine before receiving the setup command. Copying the pieceToCharTable received from an earlier game to appData cures this, because it will then be used by InitPosition, which would reset the table to default otherwise. Another problem was that setupSpoiledMachineBlack would not be reset after a game with no moves, leading to a spurious 'go' command to the engine. --- diff --git a/backend.c b/backend.c index dd962a3..6cb1bf9 100644 --- a/backend.c +++ b/backend.c @@ -8852,7 +8852,10 @@ printf("score=%d count=%d\n",score,count); int dummy, w, h, hand, s=6; char buf[MSG_SIZ], varName[MSG_SIZ]; if(appData.icsActive || forwardMostMove != 0 || cps != &first) return; *buf = NULLCHAR; - if(sscanf(message, "setup (%s", buf) == 1) s = 8 + strlen(buf), buf[s-9] = NULLCHAR, SetCharTable(pieceToChar, buf); + if(sscanf(message, "setup (%s", buf) == 1) { + s = 8 + strlen(buf), buf[s-9] = NULLCHAR, SetCharTable(pieceToChar, buf); + ASSIGN(appData.pieceToCharTable, buf); + } if(startedFromSetupPosition) return; dummy = sscanf(message+s, "%dx%d+%d_%s", &w, &h, &hand, varName); if(dummy >= 3) { @@ -10424,6 +10427,7 @@ InitChessProgram (ChessProgramState *cps, int setup) SendToProgram(buf, cps); } + setboardSpoiledMachineBlack = FALSE; SendToProgram(cps->initString, cps); if (gameInfo.variant != VariantNormal && gameInfo.variant != VariantLoadable