basic dedicated server support

This commit is contained in:
Igor Popov
2012-06-07 18:08:22 +04:00
committed by Chris Forbes
parent 03229eca0c
commit bf73cdbd01
4 changed files with 28 additions and 3 deletions

View File

@@ -302,8 +302,27 @@ namespace OpenRA
JoinLocal();
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);
modData.LoadScreen.StartGame();
Settings.Save();
if (Game.Settings.Server.Dedicated)
{
Game.CreateServer(new ServerSettings(Game.Settings.Server));
while(true)
{
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();
System.Environment.Exit(0);
}
}
}
else
{
modData.LoadScreen.StartGame();
Settings.Save();
}
}
public static void LoadShellMap()