diff --git a/MCGalaxy/Games/CTF/CtfGame.cs b/MCGalaxy/Games/CTF/CtfGame.cs index e16f3049f..f146c5c46 100644 --- a/MCGalaxy/Games/CTF/CtfGame.cs +++ b/MCGalaxy/Games/CTF/CtfGame.cs @@ -41,6 +41,9 @@ namespace MCGalaxy.Games { internal string map1 = "", map2 = "", map3 = ""; public bool started = false; + /// Gets whether CTF is currently running. + public override bool Running { get { return started; } } + public CtfTeam2 Red, Blue; List cache = new List(); diff --git a/MCGalaxy/Games/Countdown/CountdownGame.cs b/MCGalaxy/Games/Countdown/CountdownGame.cs index c1ac8d122..55410333c 100644 --- a/MCGalaxy/Games/Countdown/CountdownGame.cs +++ b/MCGalaxy/Games/Countdown/CountdownGame.cs @@ -32,6 +32,8 @@ namespace MCGalaxy.Games { /// Current status of the countdown game. public CountdownGameStatus Status = CountdownGameStatus.Disabled; + // Gets whether countdown is currently running. + public override bool Running { get { return Status != CountdownGameStatus.Disabled; } } /// Whether the game is running in freeze mode or not. public bool FreezeMode = false; diff --git a/MCGalaxy/Games/IGame.cs b/MCGalaxy/Games/IGame.cs index 089ed679b..489cb9043 100644 --- a/MCGalaxy/Games/IGame.cs +++ b/MCGalaxy/Games/IGame.cs @@ -27,6 +27,9 @@ namespace MCGalaxy.Games { /// Level instance of the map this game is running on. public Level Map; + /// Gets whether this game is currently running. + public abstract bool Running { get; } + /// Whether players are allowed to teleport to others when not in referee mode. public virtual bool TeleportAllowed { get { return true; } } diff --git a/MCGalaxy/Games/LavaSurvival/LavaSurvival.cs b/MCGalaxy/Games/LavaSurvival/LavaSurvival.cs index c52064548..0fa5ed48f 100644 --- a/MCGalaxy/Games/LavaSurvival/LavaSurvival.cs +++ b/MCGalaxy/Games/LavaSurvival/LavaSurvival.cs @@ -39,6 +39,9 @@ namespace MCGalaxy.Games public Level map; public MapSettings mapSettings; public MapData mapData; + + /// Gets whether lava survival is currently running. + public override bool Running { get { return active; } } // Settings public bool startOnStartup, sendAfkMain = true; diff --git a/MCGalaxy/Games/LevelPicker.cs b/MCGalaxy/Games/LevelPicker.cs index f10b1c1bd..18e98f200 100644 --- a/MCGalaxy/Games/LevelPicker.cs +++ b/MCGalaxy/Games/LevelPicker.cs @@ -32,7 +32,18 @@ namespace MCGalaxy.Games { internal string Candidate1 = "", Candidate2 = "", Candidate3 = ""; internal int Votes1 = 0, Votes2 = 0, Votes3 = 0; - public string ChooseNextLevel(ZSGame game) { + public void AddRecentMap(string map) { + if (RecentMaps.Count >= 20) + RecentMaps.RemoveAt(0); + RecentMaps.Add(map); + } + + public void Clear() { + QueuedMap = null; + RecentMaps.Clear(); + } + + public string ChooseNextLevel(IGame game) { if (QueuedMap != null) return QueuedMap; try { @@ -51,7 +62,7 @@ namespace MCGalaxy.Games { DoLevelVote(game); if (!game.Running) return null; - return NextLevel(r, maps, game); + return NextLevel(r, maps); } catch (Exception ex) { Logger.LogError(ex); return null; @@ -102,7 +113,7 @@ namespace MCGalaxy.Games { } } - string NextLevel(Random r, List levels, ZSGame game) { + string NextLevel(Random r, List levels) { Player[] online = PlayerInfo.Online.Items; foreach (Player pl in online) pl.voted = false; diff --git a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs index 8ad4a4061..23627b5c6 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs @@ -101,9 +101,7 @@ namespace MCGalaxy.Games { if (!Running) { Status = ZombieGameStatus.LastRound; return; } EndRound(); - if (Picker.RecentMaps.Count > 20) - Picker.RecentMaps.RemoveAt(0); - Picker.RecentMaps.Add(MapName); + Picker.AddRecentMap(MapName); } Player PickFirstZombie(Random random, List players) { diff --git a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Props.cs b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Props.cs index cc139a6cd..b4f7589f6 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Props.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Props.cs @@ -49,7 +49,7 @@ namespace MCGalaxy.Games { public ZombieGameStatus Status = ZombieGameStatus.NotStarted; /// Gets whether zombie survival is currently running. - public bool Running { get { return Status != ZombieGameStatus.NotStarted; } } + public override bool Running { get { return Status != ZombieGameStatus.NotStarted; } } /// Whether a round is currently in progress. public bool RoundInProgress = false; diff --git a/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs b/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs index 7ac8c8e0d..6f1d21b55 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZombieGame.cs @@ -198,7 +198,7 @@ namespace MCGalaxy.Games { Infected.Clear(); Bounties.Clear(); - Picker.RecentMaps.Clear(); + Picker.Clear(); foreach (Player pl in online) { pl.Game.Referee = false;