return(0);
}//- End OpenTourney
+//- PauseTourney ------------------------------------------------------------
+int CommandEntry::PauseTourney(User *user, param_list params) {
+ Tourney *tourn = NULL;
+
+ tourn = gMamer.FindTourney(params[0].val.integer);
+ if(NULL != tourn) {
+ if(tourn->GetStatus() == CLOSED) {
+ tourn->SetPause(TRUE);
+ }
+ return(1);
+ }
+ gMamer.TellUser(NotFound, user->name, "tourney");
+ return(0);
+}//- End PauseTourney
+
+//- ResumeTourney ------------------------------------------------------------
+int CommandEntry::ResumeTourney(User *user, param_list params) {
+ Tourney *tourn = NULL;
+
+ tourn = gMamer.FindTourney(params[0].val.integer);
+ if(NULL != tourn) {
+ if(tourn->GetStatus() == CLOSED && tourn->IsPaused()) {
+ tourn->SetPause(FALSE); // unpause
+ gMamer.NextRound(); // and start next round
+ }
+ return(1);
+ }
+ gMamer.TellUser(NotFound, user->name, "tourney");
+ return(0);
+}//- End ResumeTourney
+
//- AnnounceTourney ----------------------------------------------------------
int CommandEntry::AnnounceTourney(User *user, param_list params) {
Tourney *tourn = NULL;
int LoadedUsers(User *, param_list);
int MessageManagers(User *, param_list);
int OpenTourney(User *, param_list);
+ int PauseTourney(User *, param_list);
+ int ResumeTourney(User *, param_list);
int SetCommandLevel(User *, param_list);
int SetInfo(User *, param_list);
int SetManagerLevel(User *, param_list);
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();
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));
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);
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);
}
Tourney *FindTourney(int);
User *FindUser(char *);
Command *FindCommand(char *, char *);
+
+ void NextRound();
private:
void Usage(void);
int HandleGame(char *);
int HandleGameInfo(char *);
int HandlePlayerInfo(char *);
-
- void NextRound();
Player *FindPending(char *);
lastCshouted = 0;
status = NEW;
+ paused = FALSE;
}
//- Deconstructor ---------------------------------------------------------
status = DONE;
}//- End EndTourney
+//- IsPaused --------------------------------------------------------
+int Tourney::IsPaused(void) {
+ return paused;
+}
+
+//- SetPause -----------------------
+void Tourney::SetPause(int x) {
+ paused = x;
+}//- End SetPause
+
//- Announce ----------------------------------------------------------
void Tourney::Announce(void) {
char temp[128];
int IsTourney(int);
short IsNotNew(void);
short IsNotClosed(void);
+ int IsPaused(void);
int Open(void);
void CloseAndStart(void);
int GetStatus(void);
void EndTourney();
+ void SetPause(int);
void Announce(void);
time_t endDate;
int status;
+ int paused;
float averageRating;
- about forfeit manager_commands settourneyvar
- addchaos help manager_help showcommands
- addtotourney index manager_level showhelpfile
- announce join messman shutdown
- chaos keep open swiss
- close listmanagers performance upset
- create listplayers rating user_commands
- delete listtourneys setmanagerlevel who
- finger listtourneyvars setres withdraw
- forfeit loadedusers setstat
+ about forfeit manager_commands setmanagerlevel
+ addchaos help manager_help settourneyvar
+ addtotourney index manager_level setstat
+ announce join messman showcommands
+ chaos keep open showhelpfile
+ close listmanagers pause shutdown
+ create listplayers performance swiss
+ delete listtourneys rating upset
+ finger listtourneyvars resume user_commands
+ forfeit loadedusers setres withdraw
+ who
--- /dev/null
+pause
+
+Alias: pa
+
+Usage: pause <tourney number>
+
+Reserved for mamer managers (level 10 or higher)
+
+Change the tourney state from 'closed' (i.e.playing) to 'paused'.
+While paused, new rounds will not start even when all games of the previous
+round have finished.
+
+See also: resume, listtourneys
+
+[Last modified: Novemder 3, 2011 -- hgm]
--- /dev/null
+resume
+
+Alias: re
+
+Usage: resume <tourney number>
+
+Reserved for mamer managers (level 10 or higher)
+
+Change the tourney state from 'paused' to 'closed', and start the games
+of the next round when the previous round was finished.
+
+See also: pause, listtourneys
+
+[Last modified: Novemder 3, 2011 -- hgm]