From 71ad75d24941a489a162c6906998f656a7c398be Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 23 Feb 2012 20:01:55 +0100 Subject: [PATCH] Use combobox line for recent engines when available The entry made in the -recentEngineList for the startup engine was derived from the -fcp value, but this would ignore a possible nickname. In WinBoard we now use the full combobox line to derive the entry. --- backend.c | 4 +++- backend.h | 1 + winboard/winboard.c | 1 + 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/backend.c b/backend.c index 3cd2f0c..2553afb 100644 --- a/backend.c +++ b/backend.c @@ -1485,6 +1485,8 @@ MatchEvent (int mode) NextMatchGame(); } +char *comboLine = NULL; // [HGM] recent: WinBoard's first-engine combobox line + void InitBackEnd3 P((void)) { @@ -1498,7 +1500,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, appData.firstChessProgram); + FloatToFront(&appData.recentEngineList, comboLine ? comboLine : appData.firstChessProgram); } if (appData.icsActive) { diff --git a/backend.h b/backend.h index 561a0b3..3fef1ea 100644 --- a/backend.h +++ b/backend.h @@ -436,6 +436,7 @@ extern ChessProgramStats programStats; extern int opponentKibitzes; // used by wengineo.c extern int errorExitStatus; extern char *recentEngines; +extern char *comboLine; void SettingsPopUp P((ChessProgramState *cps)); // [HGM] really in front-end, but CPS not known in frontend.h int WaitForEngine P((ChessProgramState *cps, DelayedEventCallback x)); void Load P((ChessProgramState *cps, int n)); diff --git a/winboard/winboard.c b/winboard/winboard.c index 5c9bc1c..8d8b70e 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -6181,6 +6181,7 @@ 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 ParseArgs(StringGet, &p); safeStrCpy(buf, singleList ? "/fcp=" : "/scp=", sizeof(buf)/sizeof(buf[0]) ); GetDlgItemText(hDlg, OPT_SecondChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf)); -- 1.7.0.4