From: H.G.Muller Date: Fri, 26 Sep 2014 17:47:08 +0000 (+0200) Subject: Make unsupported variant on loading 1st engine non-fatal X-Git-Url: http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=commitdiff_plain;h=5a64b254d74da5a9bba1c40c51f8c32df3b1b002 Make unsupported variant on loading 1st engine non-fatal Like in the startup code, when the loaded engine does not play the currently selected variant, we now figure out what the engine does play, and switch to that. The error message still pops up, but not non-fatal. --- diff --git a/backend.c b/backend.c index 9495083a..24558d52 100644 --- a/backend.c +++ b/backend.c @@ -10486,7 +10486,19 @@ InitChessProgram (ChessProgramState *cps, int setup) b = SupportedVariant(cps->variants, gameInfo.variant, gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize, cps->protocolVersion, cps->tidy); if (b == NULL) { - DisplayFatalError(variantError, 0, 1); + VariantClass v; + char c, *q = cps->variants, *p = strchr(q, ','); + if(p) *p = NULLCHAR; + v = StringToVariant(q); + DisplayError(variantError, 0); + if(v != VariantUnknown && cps == &first) { + int w, h, s; + if(sscanf(q, "%dx%d+%d_%c", &w, &h, &s, &c) == 4) // get size overrides the engine needs with it (if any) + appData.NrFiles = w, appData.NrRanks = h, appData.holdingsSize = s, q = strchr(q, '_') + 1; + ASSIGN(appData.variant, q); + Reset(TRUE, FALSE); + } + if(p) *p = ','; return; }