diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 60899cda33..706188f88e 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -304,19 +304,30 @@ namespace OpenRA if (Game.Settings.Server.Dedicated) { - Game.CreateServer(new ServerSettings(Game.Settings.Server)); - while(true) + while (true) { - System.Threading.Thread.Sleep(100); - - //Accessing public field and List::Count is thread safe - if((server.GameStarted)&&(server.conns.Count<=1)) + Game.CreateServer(new ServerSettings(Game.Settings.Server)); + while(true) { - Console.WriteLine("No one is playing, shutting down..."); - server.Shutdown(); - System.Environment.Exit(0); + System.Threading.Thread.Sleep(100); + + //Accessing public field and List::Count is thread safe + if((server.GameStarted)&&(server.conns.Count<=1)) + { + Console.WriteLine("No one is playing, shutting down..."); + server.Shutdown(); + break; + } } + if (Game.Settings.Server.DedicatedLoop) + { + Console.WriteLine("Starting a new server instance..."); + continue; + } + else + break; } + System.Environment.Exit(0); } else { diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index d8e263e30f..800d206a5c 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -35,6 +35,7 @@ namespace OpenRA.GameRules public string[] Ban = null; public int TimeOut = 0; public bool Dedicated = false; + public bool DedicatedLoop = true; public ServerSettings() { } @@ -51,6 +52,7 @@ namespace OpenRA.GameRules Ban = other.Ban; TimeOut = other.TimeOut; Dedicated = other.Dedicated; + DedicatedLoop = other.DedicatedLoop; } }