X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=e6f48a450482513761d01c915681125f7efe1313;hb=62b9ce815b3e4ad57092f321c293895aeea4bf45;hp=ed46df04962286f30852a1351d895352001b125b;hpb=7a0b8d7db53ac678291a17799b59e137e5b589b9;p=xboard.git diff --git a/backend.c b/backend.c index ed46df0..e6f48a4 100644 --- a/backend.c +++ b/backend.c @@ -880,6 +880,7 @@ Load (ChessProgramState *cps, int i) snprintf(buf, MSG_SIZ, "-fcp %s", engineLine); SwapEngines(i); // kludge to parse -f* / -first* like it is -s* / -second* ParseArgsFromString(resetOptions); appData.fenOverride[0] = NULL; appData.pvSAN[0] = FALSE; + appData.firstProtocolVersion = PROTOVER; ParseArgsFromString(buf); SwapEngines(i); ReplaceEngine(cps, i); @@ -1396,9 +1397,13 @@ ReserveGame (int gameNr, char resChar) free(p); appData.results = q; if(nextGame <= appData.matchGames && resChar != ' ' && !abortMatch && (gameNr < 0 || nextGame / appData.defaultMatchGames != gameNr / appData.defaultMatchGames)) { + int round = appData.defaultMatchGames * appData.tourneyType; + if(gameNr < 0 || appData.tourneyType < 1 || // gauntlet engine can always stay loaded as first engine + appData.tourneyType > 1 && nextGame/round != gameNr/round) // in multi-gauntlet change only after round UnloadEngine(&first); // next game belongs to other pairing; UnloadEngine(&second); // already unload the engines, so TwoMachinesEvent will load new ones. } + if(appData.debugMode) fprintf(debugFP, "Reserved, next=%d, nr=%d, procs=(%x,%x)\n", nextGame, gameNr, first.pr, second.pr); } void @@ -2582,6 +2587,7 @@ int SeekGraphClick (ClickType click, int x, int y, int moving) { static int lastDown = 0, displayed = 0, lastSecond; + if(y < 0) return FALSE; if(!seekGraphUp) { // initiate cration of seek graph by requesting seek-ad list if(click == Release || moving) return FALSE; nrOfSeekAds = 0; @@ -2929,6 +2935,9 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int OutputKibitz(suppressKibitz, parse); } else { char tmp[MSG_SIZ]; + if(gameMode == IcsObserving) // restore original ICS messages + snprintf(tmp, MSG_SIZ, "%s kibitzes: %s", star_match[0], parse); + else snprintf(tmp, MSG_SIZ, _("your opponent kibitzes: %s"), parse); SendToPlayer(tmp, strlen(tmp)); } @@ -3062,7 +3071,8 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int if (appData.autoKibitz && started == STARTED_NONE && !appData.icsEngineAnalyze && // [HGM] [DM] ICS analyze (gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack || gameMode == IcsObserving)) { - if((looking_at(buf, &i, "* kibitzes: ") || looking_at(buf, &i, "* whispers: ")) && + if((looking_at(buf, &i, "\n* kibitzes: ") || looking_at(buf, &i, "\n* whispers: ") || + looking_at(buf, &i, "* kibitzes: ") || looking_at(buf, &i, "* whispers: ")) && (StrStr(star_match[0], gameInfo.white) == star_match[0] || StrStr(star_match[0], gameInfo.black) == star_match[0] )) { // kibitz of self or opponent suppressKibitz = TRUE; @@ -9752,7 +9762,6 @@ WriteTourneyFile (char *results, FILE *f) return f; } -#define MAXENGINES 1000 char *command[MAXENGINES], *mnemonic[MAXENGINES]; void @@ -9906,7 +9915,7 @@ SetPlayer (int player) if(mnemonic[i]) { snprintf(buf, MSG_SIZ, "-fcp %s", command[i]); ParseArgsFromString(resetOptions); appData.fenOverride[0] = NULL; appData.pvSAN[0] = FALSE; - appData.firstHasOwnBookUCI = !appData.defNoBook; + appData.firstHasOwnBookUCI = !appData.defNoBook; appData.protocolVersion[0] = PROTOVER; ParseArgsFromString(buf); } free(engineName); @@ -9948,6 +9957,9 @@ Pairing (int nr, int nPlayers, int *whitePlayer, int *blackPlayer, int *syncInte *blackPlayer = curRound + (nPlayers-1)/2 - curPairing; if(*blackPlayer >= nPlayers-1+(nPlayers&1)) *blackPlayer -= nPlayers-1+(nPlayers&1); } + } else if(appData.tourneyType > 1) { + *blackPlayer = curPairing; // in multi-gauntlet, assign gauntlet engines to second, so first an be kept loaded during round + *whitePlayer = curRound + appData.tourneyType; } else if(appData.tourneyType > 0) { *whitePlayer = curPairing; *blackPlayer = curRound + appData.tourneyType; @@ -10009,16 +10021,20 @@ NextTourneyGame (int nr, int *swapColors) matchGame = 1; roundNr = nr / syncInterval + 1; } - if(first.pr != NoProc || second.pr != NoProc) return 1; // engines already loaded + if(first.pr != NoProc && second.pr != NoProc) return 1; // engines already loaded // redefine engines, engine dir, etc. NamesToList(firstChessProgramNames, command, mnemonic); // get mnemonics of installed engines - SetPlayer(whitePlayer); // find white player amongst it, and parse its engine line - SwapEngines(1); - SetPlayer(blackPlayer); // find black player amongst it, and parse its engine line - SwapEngines(1); // and make that valid for second engine by swapping - InitEngine(&first, 0); // initialize ChessProgramStates based on new settings. - InitEngine(&second, 1); + if(first.pr == NoProc || nr < 0) { + SetPlayer(whitePlayer); // find white player amongst it, and parse its engine line + InitEngine(&first, 0); // initialize ChessProgramStates based on new settings. + } + if(second.pr == NoProc) { + SwapEngines(1); + SetPlayer(blackPlayer); // find black player amongst it, and parse its engine line + SwapEngines(1); // and make that valid for second engine by swapping + InitEngine(&second, 1); + } CommonEngineInit(); // after this TwoMachinesEvent will create correct engine processes UpdateLogos(FALSE); // leave display to ModeHiglight() return 1; @@ -14157,6 +14173,7 @@ ForwardInner (int target) if (gameMode == EditPosition) return; + seekGraphUp = FALSE; MarkTargetSquares(1); if (gameMode == PlayFromGameFile && !pausing) @@ -14263,6 +14280,7 @@ BackwardInner (int target) target, currentMove, forwardMostMove); if (gameMode == EditPosition) return; + seekGraphUp = FALSE; MarkTargetSquares(1); if (currentMove <= backwardMostMove) { ClearHighlights(); @@ -15366,7 +15384,7 @@ ParseFeatures (char *args, ChessProgramState *cps) continue; } if (BoolFeature(&p, "analyze", &cps->analysisSupport, cps)) continue; - if (StringFeature(&p, "myname", &cps->tidy, cps)) { + if (StringFeature(&p, "myname", cps->tidy, cps)) { if (gameMode == TwoMachinesPlay) { DisplayTwoMachinesTitle(); } else { @@ -15374,7 +15392,7 @@ ParseFeatures (char *args, ChessProgramState *cps) } continue; } - if (StringFeature(&p, "variants", &cps->variants, cps)) continue; + if (StringFeature(&p, "variants", cps->variants, cps)) continue; if (BoolFeature(&p, "san", &cps->useSAN, cps)) continue; if (BoolFeature(&p, "ping", &cps->usePing, cps)) continue; if (BoolFeature(&p, "playother", &cps->usePlayother, cps)) continue; @@ -15398,8 +15416,8 @@ ParseFeatures (char *args, ChessProgramState *cps) if (IntFeature(&p, "level", &cps->maxNrOfSessions, cps)) continue; if (BoolFeature(&p, "memory", &cps->memSize, cps)) continue; if (BoolFeature(&p, "smp", &cps->maxCores, cps)) continue; - if (StringFeature(&p, "egt", &cps->egtFormats, cps)) continue; - if (StringFeature(&p, "option", &(cps->option[cps->nrOptions].name), cps)) { + if (StringFeature(&p, "egt", cps->egtFormats, cps)) continue; + if (StringFeature(&p, "option", cps->option[cps->nrOptions].name, cps)) { if(!ParseOption(&(cps->option[cps->nrOptions++]), cps)) { // [HGM] options: add option feature snprintf(buf, MSG_SIZ, "rejected option %s\n", cps->option[--cps->nrOptions].name); SendToProgram(buf, cps);