From be547479ce6fbf7b68eac6c61cb3d60afaa99dd1 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 13 Mar 2010 12:46:19 +1300 Subject: [PATCH] killed InProcServer class; use ListenPort, ExternalPort, and GameName settings from settings.ini --- OpenRA.Game/Game.cs | 13 ++++++------- OpenRA.Game/GameRules/UserSettings.cs | 4 ++++ OpenRA.Game/Server/Server.cs | 13 +------------ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 20fb8a5872..083238d4e5 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -156,13 +156,12 @@ namespace OpenRA internal static void CreateServer() { // todo: LobbyInfo is the wrong place for this. - InprocServer.Start(Game.LobbyInfo.GlobalSettings.Mods); - JoinServer(IPAddress.Loopback.ToString(), 1234); - } - - internal static void CloseServer() - { - InprocServer.Stop(); + var mods = LobbyInfo.GlobalSettings.Mods; + var gameName = "{0} ({1})".F( Settings.GameName, string.Join( ",", mods ) ); + + Server.Server.ServerMain(gameName, Settings.ListenPort, + Settings.ExternalPort, mods); + JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort); } static int lastTime = Environment.TickCount; diff --git a/OpenRA.Game/GameRules/UserSettings.cs b/OpenRA.Game/GameRules/UserSettings.cs index f14383f2f9..dee8799c52 100644 --- a/OpenRA.Game/GameRules/UserSettings.cs +++ b/OpenRA.Game/GameRules/UserSettings.cs @@ -44,6 +44,10 @@ namespace OpenRA.GameRules public readonly string Replay = ""; public readonly string PlayerName = ""; public readonly string[] InitialMods = { "ra" }; + + public readonly string GameName = "OpenRA Game"; + public readonly int ListenPort = 1234; + public readonly int ExternalPort = 1234; // Gameplay options // TODO: These need to die diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index de1b8a536b..590f93da99 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -26,8 +26,8 @@ using System.Linq; using System.Net; using System.Net.Sockets; using System.Security.Cryptography; -using OpenRA.FileFormats; using System.Threading; +using OpenRA.FileFormats; namespace OpenRA.Server { @@ -566,15 +566,4 @@ namespace OpenRA.Server lastPing = Environment.TickCount; } } - - // temporary threaded inproc server wrapper. - public static class InprocServer - { - public static void Start( string[] mods ) - { - Server.ServerMain( "OpenRA Server", 1234, 1234, mods ); - } - - public static void Stop() { } - } }