From 5a64b254d74da5a9bba1c40c51f8c32df3b1b002 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 26 Sep 2014 19:47:08 +0200 Subject: [PATCH] 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. --- backend.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/backend.c b/backend.c index 9495083..24558d5 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; } -- 1.7.0.4