From: H.G. Muller Date: Sat, 7 Aug 2010 14:35:23 +0000 (+0200) Subject: Allow match to be started from WB menu X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d034ad3de00369266ca2c24ba1b725d04dd94ee4;p=xboard.git Allow match to be started from WB menu A menu item Machine Match was added in the Mode menu to switch to matchMode. A persistent option /defaultMatchGames determines the number of games. A control was added to the Options -> Common Engine dialog to set this option. --- diff --git a/args.h b/args.h index 11b630d..e897749 100644 --- a/args.h +++ b/args.h @@ -551,6 +551,7 @@ ArgDescriptor argDescriptors[] = { { "boardWidth", ArgInt, (void *) &appData.NrFiles, TRUE, (ArgIniType) -1 }, { "boardHeight", ArgInt, (void *) &appData.NrRanks, TRUE, (ArgIniType) -1 }, { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, TRUE, (ArgIniType) -1 }, + { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 }, { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 }, { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID }, { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID }, diff --git a/backend.h b/backend.h index 38515df..0305dbb 100644 --- a/backend.h +++ b/backend.h @@ -99,6 +99,8 @@ extern int gotPremove; extern GameMode gameMode; +extern int matchMode; +extern int matchGame; extern int pausing, cmailMsgLoaded, flipView, mute; extern char white_holding[], black_holding[]; extern int currentMove, backwardMostMove, forwardMostMove; diff --git a/common.h b/common.h index 9b9b0e6..d5e23ee 100644 --- a/common.h +++ b/common.h @@ -574,6 +574,7 @@ typedef struct { int defaultHashSize; int defaultCacheSizeEGTB; char * defaultPathEGTB; + int defaultMatchGames; /* [HGM] Board size */ int NrFiles; diff --git a/winboard/resource.h b/winboard/resource.h index 74e350d..d536ee6 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -63,6 +63,7 @@ #define IDM_TypeInName 185 #define IDM_MachineBoth 186 #define IDM_MuteSounds 187 +#define IDM_Match 188 #define OPT_TCtext1 202 #define OPT_TCTime 203 #define OPT_TCtext2 204 @@ -459,6 +460,7 @@ #define IDC_Cores 1473 #define IDC_BookDep 1474 #define IDC_BookStr 1475 +#define IDC_Games 1476 #define DLG_NewVariant 1500 #define OPT_VariantGothic 1501 #define OPT_VariantCrazyhouse 1502 diff --git a/winboard/winboard.c b/winboard/winboard.c index e4e8db9..9cc79da 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -4555,6 +4555,12 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) SAY("computer starts playing black"); break; + case IDM_Match: // [HGM] match: flows into next case, after setting Match Mode and nr of Games + if(gameMode != BeginningOfGame) break; // allow menu item to remain enabled for better mode highligting + matchMode = 2;// distinguish from command-line-triggered case (matchMode=1) + appData.matchGames = appData.defaultMatchGames; + matchGame = 1; + case IDM_TwoMachines: TwoMachinesEvent(); /* @@ -7449,6 +7455,7 @@ Enables icsEnables[] = { { IDM_MachineWhite, MF_BYCOMMAND|MF_GRAYED }, { IDM_MachineBlack, MF_BYCOMMAND|MF_GRAYED }, { IDM_TwoMachines, MF_BYCOMMAND|MF_GRAYED }, + { IDM_Match, MF_BYCOMMAND|MF_GRAYED }, { IDM_MachineBoth, MF_BYCOMMAND|MF_GRAYED }, { IDM_AnalysisMode, MF_BYCOMMAND|MF_ENABLED }, { IDM_AnalyzeFile, MF_BYCOMMAND|MF_GRAYED }, @@ -7479,6 +7486,7 @@ Enables ncpEnables[] = { { IDM_MachineWhite, MF_BYCOMMAND|MF_GRAYED }, { IDM_MachineBlack, MF_BYCOMMAND|MF_GRAYED }, { IDM_TwoMachines, MF_BYCOMMAND|MF_GRAYED }, + { IDM_Match, MF_BYCOMMAND|MF_GRAYED }, { IDM_AnalysisMode, MF_BYCOMMAND|MF_GRAYED }, { IDM_AnalyzeFile, MF_BYCOMMAND|MF_GRAYED }, { IDM_IcsClient, MF_BYCOMMAND|MF_GRAYED }, @@ -7547,6 +7555,7 @@ Enables machineThinkingEnables[] = { { IDM_MachineWhite, MF_BYCOMMAND|MF_GRAYED }, { IDM_MachineBlack, MF_BYCOMMAND|MF_GRAYED }, { IDM_TwoMachines, MF_BYCOMMAND|MF_GRAYED }, + { IDM_Match, MF_BYCOMMAND|MF_GRAYED }, { IDM_TypeInMove, MF_BYCOMMAND|MF_GRAYED }, { IDM_RetractMove, MF_BYCOMMAND|MF_GRAYED }, { -1, -1 } @@ -7566,6 +7575,7 @@ Enables userThinkingEnables[] = { { IDM_MachineWhite, MF_BYCOMMAND|MF_ENABLED }, { IDM_MachineBlack, MF_BYCOMMAND|MF_ENABLED }, { IDM_TwoMachines, MF_BYCOMMAND|MF_ENABLED }, + { IDM_Match, MF_BYCOMMAND|MF_ENABLED }, { IDM_TypeInMove, MF_BYCOMMAND|MF_ENABLED }, { IDM_RetractMove, MF_BYCOMMAND|MF_ENABLED }, { -1, -1 } @@ -7607,7 +7617,7 @@ ModeHighlight() nowChecked = IDM_MachineWhite; break; case TwoMachinesPlay: - nowChecked = IDM_TwoMachines; + nowChecked = matchMode ? IDM_Match : IDM_TwoMachines; // [HGM] match break; case AnalyzeMode: nowChecked = IDM_AnalysisMode; @@ -7748,7 +7758,7 @@ SetMachineThinkingEnables() } else if (gameMode == MachinePlaysWhite) { (void)EnableMenuItem(hMenu, IDM_MachineWhite, flags); } else if (gameMode == TwoMachinesPlay) { - (void)EnableMenuItem(hMenu, IDM_TwoMachines, flags); + (void)EnableMenuItem(hMenu, matchMode ? IDM_Match : IDM_TwoMachines, flags); // [HGM] match } } diff --git a/winboard/winboard.rc b/winboard/winboard.rc index 254b07b..dadb7b8 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -939,6 +939,8 @@ BEGIN EDITTEXT IDC_BookDep,162,94,40,14,ES_AUTOHSCROLL LTEXT "Book Variation:",IDC_STATIC,106,116,52,8 EDITTEXT IDC_BookStr,162,112,40,14,ES_AUTOHSCROLL + LTEXT "Default Match Games:",IDC_STATIC,2,135,72,8 + EDITTEXT IDC_Games,76,131,28,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,118,142,50,14 PUSHBUTTON "Cancel",IDCANCEL,174,142,50,14 END @@ -1132,7 +1134,8 @@ BEGIN MENUITEM "Machine &White\tCtrl+W", IDM_MachineWhite MENUITEM "Machine &Black\tCtrl+B", IDM_MachineBlack MENUITEM "Two &Machines\tCtrl+T", IDM_TwoMachines - MENUITEM "Machine Bot&h", IDM_MachineBoth + MENUITEM "Machine Both", IDM_MachineBoth + MENUITEM "Machine Matc&h", IDM_Match MENUITEM "&Analysis Mode\tCtrl+A", IDM_AnalysisMode MENUITEM "Analyze &File\tCtrl+F", IDM_AnalyzeFile MENUITEM "&ICS Client", IDM_IcsClient diff --git a/winboard/woptions.c b/winboard/woptions.c index 36beec9..0f035b9 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -2920,6 +2920,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM CheckDlgButton( hDlg, IDC_OwnBook2, (BOOL) appData.secondHasOwnBookUCI ); SetDlgItemInt( hDlg, IDC_BookDep, appData.bookDepth, TRUE ); SetDlgItemInt( hDlg, IDC_BookStr, appData.bookStrength, TRUE ); + SetDlgItemInt( hDlg, IDC_Games, appData.defaultMatchGames, TRUE ); SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 ); @@ -2946,6 +2947,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM appData.secondHasOwnBookUCI = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook2 ); appData.bookDepth = GetDlgItemInt(hDlg, IDC_BookDep, NULL, FALSE ); appData.bookStrength = GetDlgItemInt(hDlg, IDC_BookStr, NULL, FALSE ); + appData.defaultMatchGames = GetDlgItemInt(hDlg, IDC_Games, NULL, FALSE ); if(gameMode == BeginningOfGame) Reset(TRUE, TRUE); EndDialog(hDlg, TRUE);