}
void
+SaveEngineList ()
+{
+ FILE *f;
+ if(*engineListFile && (f = fopen(engineListFile, "w"))) {
+ fprintf(f, "-firstChessProgramNames {%s}\n", firstChessProgramNames);
+ fclose(f);
+ }
+}
+
+void
AddToEngineList (int i)
{
int len;
if(insert != q) insert[-1] = NULLCHAR;
snprintf(firstChessProgramNames, len, "%s\n%s\n%s", q, buf, insert);
if(q) free(q);
+ SaveEngineList();
FloatToFront(&appData.recentEngineList, buf);
ASSIGN(currentEngine[i], buf);
}
{
int len; char *p, *q, *s, buf[MSG_SIZ], *optionSettings;
if(!currentEngine[n] || !currentEngine[n][0]) { DisplayMessage("saving failed: engine not from list", ""); return; } // no engine from list is loaded
+ if(*engineListFile) ParseSettingsFile(engineListFile, &engineListFile); // update engine list
p = strstr(firstChessProgramNames, currentEngine[n]);
if(!p) { DisplayMessage("saving failed: engine not found in list", ""); return; } // sanity check; engine could be deleted from list after loading
optionSettings = ResendOptions(n ? &second : &first, FALSE);
s = malloc(len);
snprintf(s, len, "%s%s%s", firstChessProgramNames, currentEngine[n], q);
FREE(firstChessProgramNames); firstChessProgramNames = s; // new list
+ if(*engineListFile) SaveEngineList();
}
// following implemented as macro to avoid type limitations