dedicated: start a new server instance once previous game is finished (configurable)

This commit is contained in:
Igor Popov
2012-06-07 19:59:28 +04:00
committed by Chris Forbes
parent b45f9568d0
commit bd45ffa022
2 changed files with 22 additions and 9 deletions

View File

@@ -303,6 +303,8 @@ namespace OpenRA
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer); viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);
if (Game.Settings.Server.Dedicated) if (Game.Settings.Server.Dedicated)
{
while (true)
{ {
Game.CreateServer(new ServerSettings(Game.Settings.Server)); Game.CreateServer(new ServerSettings(Game.Settings.Server));
while(true) while(true)
@@ -314,10 +316,19 @@ namespace OpenRA
{ {
Console.WriteLine("No one is playing, shutting down..."); Console.WriteLine("No one is playing, shutting down...");
server.Shutdown(); server.Shutdown();
break;
}
}
if (Game.Settings.Server.DedicatedLoop)
{
Console.WriteLine("Starting a new server instance...");
continue;
}
else
break;
}
System.Environment.Exit(0); System.Environment.Exit(0);
} }
}
}
else else
{ {
modData.LoadScreen.StartGame(); modData.LoadScreen.StartGame();

View File

@@ -35,6 +35,7 @@ namespace OpenRA.GameRules
public string[] Ban = null; public string[] Ban = null;
public int TimeOut = 0; public int TimeOut = 0;
public bool Dedicated = false; public bool Dedicated = false;
public bool DedicatedLoop = true;
public ServerSettings() { } public ServerSettings() { }
@@ -51,6 +52,7 @@ namespace OpenRA.GameRules
Ban = other.Ban; Ban = other.Ban;
TimeOut = other.TimeOut; TimeOut = other.TimeOut;
Dedicated = other.Dedicated; Dedicated = other.Dedicated;
DedicatedLoop = other.DedicatedLoop;
} }
} }