}
void
+MatchEvent(int mode)
+{ // [HGM] moved out of InitBackend3, to make it callable when match starts through menu
+ /* Set up machine vs. machine match */
+ if (appData.noChessProgram) {
+ DisplayFatalError(_("Can't have a match with no chess programs"),
+ 0, 2);
+ return;
+ }
+ matchMode = mode;
+ matchGame = 1;
+ if (*appData.loadGameFile != NULLCHAR) {
+ int index = appData.loadGameIndex; // [HGM] autoinc
+ if(index<0) lastIndex = index = 1;
+ if (!LoadGameFromFile(appData.loadGameFile,
+ index,
+ appData.loadGameFile, FALSE)) {
+ DisplayFatalError(_("Bad game file"), 0, 1);
+ return;
+ }
+ } else if (*appData.loadPositionFile != NULLCHAR) {
+ int index = appData.loadPositionIndex; // [HGM] autoinc
+ if(index<0) lastIndex = index = 1;
+ if (!LoadPositionFromFile(appData.loadPositionFile,
+ index,
+ appData.loadPositionFile)) {
+ DisplayFatalError(_("Bad position file"), 0, 1);
+ return;
+ }
+ }
+ first.matchWins = second.matchWins = 0; // [HGM] match: needed in later matches\r
+ TwoMachinesEvent();
+}
+
+void
InitBackEnd3 P((void))
{
GameMode initialMode;
}
if (appData.matchMode) {
- /* Set up machine vs. machine match */
- if (appData.noChessProgram) {
- DisplayFatalError(_("Can't have a match with no chess programs"),
- 0, 2);
- return;
- }
- matchMode = TRUE;
- matchGame = 1;
- if (*appData.loadGameFile != NULLCHAR) {
- int index = appData.loadGameIndex; // [HGM] autoinc
- if(index<0) lastIndex = index = 1;
- if (!LoadGameFromFile(appData.loadGameFile,
- index,
- appData.loadGameFile, FALSE)) {
- DisplayFatalError(_("Bad game file"), 0, 1);
- return;
- }
- } else if (*appData.loadPositionFile != NULLCHAR) {
- int index = appData.loadPositionIndex; // [HGM] autoinc
- if(index<0) lastIndex = index = 1;
- if (!LoadPositionFromFile(appData.loadPositionFile,
- index,
- appData.loadPositionFile)) {
- DisplayFatalError(_("Bad position file"), 0, 1);
- return;
- }
- }
- TwoMachinesEvent();
+ MatchEvent(TRUE);
} else if (*appData.cmailGameName != NULLCHAR) {
/* Set up cmail mode */
ReloadCmailMsgEvent(TRUE);
void ExitAnalyzeMode P((void));
void AnalyzeModeEvent P((void));
void AnalyzeFileEvent P((void));
+void MatchEvent P((int mode));
void InitPosition P((int redraw));
void NewSettingEvent P((int option, int *feature, char *command, int value));
int WaitForSecond P((DelayedEventCallback x));
if(gameMode != BeginningOfGame) { // allow menu item to remain enabled for better mode highligting\r
DisplayError(_("You can only start a match from the initial position."), 0); break;\r
}\r
- matchMode = 2;// distinguish from command-line-triggered case (matchMode=1)\r
- appData.matchGames = appData.defaultMatchGames;\r
- matchGame = 1;\r
- first.matchWins = second.matchWins = 0;\r
+ appData.matchGames = appData.defaultMatchGames;
+ MatchEvent(2); // distinguish from command-line-triggered case (matchMode=1)\r
+ break;\r
\r
case IDM_TwoMachines:\r
TwoMachinesEvent();\r
Cardinal *nprms;
{
if(gameMode != BeginningOfGame) { DisplayError(_("You can only start a match from the initial position."), 0); return; }
- matchMode = 2; // This is back-end, really\r
- appData.matchGames = appData.defaultMatchGames;\r
- matchGame = 1;\r
- first.matchWins = second.matchWins = 0;\r
- TwoMachinesEvent();
+ appData.matchGames = appData.defaultMatchGames;
+ MatchEvent(2);\r
}
void IcsClientProc(w, event, prms, nprms)