From: H.G.Muller Date: Thu, 5 Jan 2017 16:05:22 +0000 (+0100) Subject: Fix awareness of settings changed by -firstOption X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=d45b23cf75433a48797cfc5e81ce8fdcfea7c94b Fix awareness of settings changed by -firstOption Options of the type -file and -path that were set through -firstOptions would not get their 'current value' updated, so that XBoard would not set them properly on a reload because of reuse=0. In addition the default value for all option types would be remembered as the value specified by -firstOptions, rather than the engine default, possibly preventing their saving on Make Persistent. --- diff --git a/backend.c b/backend.c index 7cc8f9c..29b473b 100644 --- a/backend.c +++ b/backend.c @@ -17362,6 +17362,8 @@ ParseOption (Option *opt, ChessProgramState *cps) opt->type = SaveButton; } else return FALSE; *p = 0; // terminate option name + *(int*) (opt->name + MSG_SIZ - 104) = opt->value; // hide default values somewhere + if(opt->target == &opt->textValue) strncpy(opt->name + MSG_SIZ - 100, opt->textValue, 99); // now look if the command-line options define a setting for this engine option. if(cps->optionSettings && cps->optionSettings[0]) p = strstr(cps->optionSettings, opt->name); else p = NULL; @@ -17374,6 +17376,8 @@ ParseOption (Option *opt, ChessProgramState *cps) if(!strcmp(((char**)opt->textValue)[n], q+1)) opt->value = n; break; case TextBox: + case FileName: + case PathName: safeStrCpy(opt->textValue, q+1, MSG_SIZ - (opt->textValue - opt->name)); break; case Spin: @@ -17385,8 +17389,6 @@ ParseOption (Option *opt, ChessProgramState *cps) strcat(buf, "\n"); SendToProgram(buf, cps); } - *(int*) (opt->name + MSG_SIZ - 104) = opt->value; // hide default values somewhere - if(opt->target == &opt->textValue) strncpy(opt->name + MSG_SIZ - 100, opt->textValue, 99); return TRUE; }