From bcf2f5c3aa7c039f0dca16dd6e4e741b7f184ba2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 2 Dec 2016 08:48:20 +0100 Subject: [PATCH] Remember engine lines selected in Startup Dialog (WB) The comboboxes in the Startup Dialog do contain complete engine lines from the Engine List, so selecting an engine from there should also allow use of the Make Persistent button in the Engine Settings dialogs. To this end the selected lines are now remembered incurrentEngine[]. --- backend.c | 4 +--- backend.h | 2 +- winboard/winboard.c | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/backend.c b/backend.c index faeccf5..12aadc1 100644 --- a/backend.c +++ b/backend.c @@ -1593,8 +1593,6 @@ MatchEvent (int mode) NextMatchGame(); } -char *comboLine = NULL; // [HGM] recent: WinBoard's first-engine combobox line - void InitBackEnd3 P((void)) { @@ -1626,7 +1624,7 @@ InitBackEnd3 P((void)) free(programVersion); programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING) + strlen(first.tidy)); sprintf(programVersion, "%s + %s", PACKAGE_STRING, first.tidy); - FloatToFront(&appData.recentEngineList, comboLine ? comboLine : appData.firstChessProgram); + FloatToFront(&appData.recentEngineList, currentEngine[0] ? currentEngine[0] : appData.firstChessProgram); } if (appData.icsActive) { diff --git a/backend.h b/backend.h index 83c61ff..74926b6 100644 --- a/backend.h +++ b/backend.h @@ -413,7 +413,7 @@ extern ChessProgramStats programStats; extern int opponentKibitzes; // used by wengineo.c extern int errorExitStatus; extern char *recentEngines; -extern char *comboLine; +extern char *currentEngine[]; extern Boolean partnerUp, twoBoards; extern char engineVariant[]; void SaveEngineSettings P((int n)); diff --git a/winboard/winboard.c b/winboard/winboard.c index 293b643..519f924 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -6451,11 +6451,12 @@ StartupDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) safeStrCpy(buf, "/fcp=", sizeof(buf)/sizeof(buf[0]) ); GetDlgItemText(hDlg, OPT_ChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf)); p = buf; - comboLine = strdup(p+5); // [HGM] recent: remember complete line of first combobox + currentEngine[0] = strdup(p+5); // [HGM] recent: remember complete line of first combobox ParseArgs(StringGet, &p); safeStrCpy(buf, singleList ? "/fcp=" : "/scp=", sizeof(buf)/sizeof(buf[0]) ); GetDlgItemText(hDlg, OPT_SecondChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf)); p = buf; + currentEngine[1] = strdup(p+5); // [HGM] also remember engine line of 2nd for saving its settings SwapEngines(singleList); // temporarily swap first and second, to load a second 'first', ... ParseArgs(StringGet, &p); SwapEngines(singleList); // ... and then make it 'second' -- 1.7.0.4