From: H.G.Muller Date: Thu, 24 Mar 2016 15:15:47 +0000 (+0100) Subject: Fix variant switch on engine load X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=081595f00415931efe58202f9e9981fae1de4ac6;p=xboard.git Fix variant switch on engine load When an engine was installed with an engine-defined variant, selecting that engine through the Load Engine dialog did not properly switch to the intended variant. Now doing this at the start of a game forces an extra New Game event. This event now also remembers the name of any unknown variant, in the hope the engine will define it. --- diff --git a/backend.c b/backend.c index 734cf40..216afc8 100644 --- a/backend.c +++ b/backend.c @@ -996,6 +996,7 @@ Load (ChessProgramState *cps, int i) SwapEngines(i); ReplaceEngine(cps, i); FloatToFront(&appData.recentEngineList, engineLine); + if(gameMode == BeginningOfGame) Reset(TRUE, TRUE); return; } p = engineName; @@ -10789,6 +10790,7 @@ InitChessProgram (ChessProgramState *cps, int setup) b = SupportedVariant(cps->variants, gameInfo.variant, gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize, cps->protocolVersion, cps->tidy); + if (b == NULL) { VariantClass v; char c, *q = cps->variants, *p = strchr(q, ','); @@ -11971,7 +11973,10 @@ Reset (int redraw, int init) lastHint[0] = NULLCHAR; ClearGameInfo(&gameInfo); gameInfo.variant = StringToVariant(appData.variant); - if(gameInfo.variant == VariantNormal && strcmp(appData.variant, "normal")) gameInfo.variant = VariantUnknown; + if(gameInfo.variant == VariantNormal && strcmp(appData.variant, "normal")) { + gameInfo.variant = VariantUnknown; + strncpy(engineVariant, appData.variant, MSG_SIZ); + } ics_user_moved = ics_clock_paused = FALSE; ics_getting_history = H_FALSE; ics_gamenum = -1;