Add pause function to mamer
[capablanca.git] / lasker-2.2.3 / bots / mamer / Mamer.cc
index ee10805..e09cddf 100644 (file)
@@ -1207,7 +1207,7 @@ int Mamer::HandleGame(char *message) {
            continue;
          }
          moreGames = t->SetGameResult(user1, user2, result_code);  //- SetGameResult deletes the game for us
-         if(moreGames == 2) {
+         if(moreGames == 2 && !t->IsPaused()) {
            moreRounds = (t->GetRoundsRemaining());
            LinkListIter<TourneyPlayers> playerIter(t->playerList);
            playerIter.Reset();
@@ -1469,6 +1469,12 @@ void Mamer::BuildCommandList(void) {
     commandList.Append(new Command("open", "ot", DIRECTOR, "Opens the tournament to players.",
                                   "d", (USERFP)&Mamer::OpenTourney));
 
+    commandList.Append(new Command("pause", "pa", DIRECTOR, "Supresses start of new round.",
+                                  "d", (USERFP)&Mamer::PauseTourney));
+
+    commandList.Append(new Command("resume", "re", DIRECTOR, "Resumes a paused tournament.",
+                                  "d", (USERFP)&Mamer::ResumeTourney));
+
     commandList.Append(new Command("setcommandlevel", "setcl", VICE, "Set the level required to execute a command.",
                                   "wd", (USERFP)&Mamer::SetCommandLevel));
 
@@ -1516,7 +1522,7 @@ void Mamer::NextRound() {
   LinkListIter<Tourney> tourneyIter(tourneyList);
   tourneyIter.Reset();
   while((t = tourneyIter.Next())) {
-    if(t->GetStatus() != CLOSED) continue;
+    if(t->GetStatus() != CLOSED || t->IsPaused()) continue;
     moreRounds = (t->GetRoundsRemaining());
     moreGames = 0;
     LinkListIter<Game> gameIter(t->gameList);
@@ -1532,7 +1538,7 @@ void Mamer::NextRound() {
        if(madeMoreGames) 
          t->TellThemWhoTheyPlay();
        else {    // tourney over!
-         cerr << "Coulnd't make any more games.  End of Tourney.  From Next Round" << endl;
+         cerr << "Couldn't make any more games.  End of Tourney.  From Next Round" << endl;
          AnnounceTourneyEnd(t);
          savePlayerData(t);
        }