From: H.G. Muller Date: Tue, 2 Nov 2010 12:06:58 +0000 (+0100) Subject: Remember values set by -firstOptions, -secondOptions X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c260fe245921dcbd737faaf4638e4fb3354717f0;p=xboard.git Remember values set by -firstOptions, -secondOptions When an engine announces its option features, and the option name matches that of a setting given in -first/secondOptions, the engine is sent hte specified value, but this value was not remembered as current value (but the latter was left at the engine-announced default), leading to inconsistent behavior in the Engine #N Settings dialog. --- diff --git a/backend.c b/backend.c index 07df9ce..de835ae 100644 --- a/backend.c +++ b/backend.c @@ -13803,6 +13803,20 @@ ParseOption(Option *opt, ChessProgramState *cps) if(p && (p == cps->optionSettings || p[-1] == ',')) { snprintf(buf, MSG_SIZ, "option %s", p); if(p = strstr(buf, ",")) *p = 0; + if(q = strchr(buf, '=')) switch(opt->type) { + case ComboBox: + for(n=0; nmax; n++) + if(!strcmp(((char**)opt->textValue)[n], q+1)) opt->value = n; + break; + case TextBox: + safeStrCpy(opt->textValue, q+1, MSG_SIZ - (opt->textValue - opt->name)); + break; + case Spin: + case CheckBox: + opt->value = atoi(q+1); + default: + break; + } strcat(buf, "\n"); SendToProgram(buf, cps); }