dedicated: start a new server instance once previous game is finished (configurable)
This commit is contained in:
@@ -304,19 +304,30 @@ namespace OpenRA
|
|||||||
|
|
||||||
if (Game.Settings.Server.Dedicated)
|
if (Game.Settings.Server.Dedicated)
|
||||||
{
|
{
|
||||||
Game.CreateServer(new ServerSettings(Game.Settings.Server));
|
while (true)
|
||||||
while(true)
|
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(100);
|
Game.CreateServer(new ServerSettings(Game.Settings.Server));
|
||||||
|
while(true)
|
||||||
//Accessing public field and List::Count is thread safe
|
|
||||||
if((server.GameStarted)&&(server.conns.Count<=1))
|
|
||||||
{
|
{
|
||||||
Console.WriteLine("No one is playing, shutting down...");
|
System.Threading.Thread.Sleep(100);
|
||||||
server.Shutdown();
|
|
||||||
System.Environment.Exit(0);
|
//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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user