diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 083238d4e5..2af79c6235 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; +using System.Net; using System.Windows.Forms; using OpenRA.FileFormats; using OpenRA.GameRules; @@ -32,8 +32,6 @@ using OpenRA.Network; using OpenRA.Support; using OpenRA.Traits; using Timer = OpenRA.Support.Timer; -using OpenRA.Server; -using System.Net; namespace OpenRA { @@ -156,11 +154,9 @@ namespace OpenRA internal static void CreateServer() { // todo: LobbyInfo is the wrong place for this. - var mods = LobbyInfo.GlobalSettings.Mods; - var gameName = "{0} ({1})".F( Settings.GameName, string.Join( ",", mods ) ); + Server.Server.ServerMain(Settings.GameName, Settings.ListenPort, + Settings.ExternalPort, LobbyInfo.GlobalSettings.Mods); - Server.Server.ServerMain(gameName, Settings.ListenPort, - Settings.ExternalPort, mods); JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort); } @@ -387,7 +383,6 @@ namespace OpenRA throw new InvalidOperationException("Unable to load MIX files."); Directory.SetCurrentDirectory(".."); } - LoadUserSettings(settings); Game.LobbyInfo.GlobalSettings.Mods = Game.Settings.InitialMods; @@ -408,7 +403,6 @@ namespace OpenRA Game.Initialize(Game.Settings.Map, renderer, new int2(resolution), Game.Settings.Player, controller); - // ShowCursor(false); Game.ResetTimer(); } diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 590f93da99..849c1f1a9e 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -47,7 +47,8 @@ namespace OpenRA.Server const int DownloadChunkInterval = 20000; const int DownloadChunkSize = 16384; - const int MasterPingInterval = 60 * 5; // 5 minutes + const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit + // of leeway. static int lastPing = 0; public static void ServerMain(string name, int port, int extport, string[] mods) @@ -558,10 +559,12 @@ namespace OpenRA.Server if (wc.IsBusy) return; wc.DownloadDataAsync(new Uri( - "http://open-ra.org/master/ping.php?port={0}&name={1}&state={2}&players={3}".F( + "http://open-ra.org/master/ping.php?port={0}&name={1}&state={2}&players={3}&mods={4}&map={5}".F( ExternalPort, Uri.EscapeUriString(Name), GameStarted ? 2 : 1, // todo: post-game states, etc. - lobbyInfo.Clients.Count))); + lobbyInfo.Clients.Count, + string.Join(",", lobbyInfo.GlobalSettings.Mods), + lobbyInfo.GlobalSettings.Map))); lastPing = Environment.TickCount; } diff --git a/web/master/create.php b/web/master/create.php index fb5f2abbec..16ea9fda86 100644 --- a/web/master/create.php +++ b/web/master/create.php @@ -3,7 +3,8 @@ if ($db = sqlite_open('openra.db', 0666, $e)) { echo 'sqlite_open ok.'; - sqlite_query( $db, 'CREATE TABLE servers (name varchar(255), address varchar(255), players integer, state integer, ts integer)' ); + sqlite_query( $sb, 'DROP TABLE servers' ); + sqlite_query( $db, 'CREATE TABLE servers (name varchar(255), address varchar(255), players integer, state integer, ts integer, map varchar(255), mods varchar(255))' ); sqlite_close( $db ); } else diff --git a/web/master/list.php b/web/master/list.php index e635fb6447..e09f50a077 100644 --- a/web/master/list.php +++ b/web/master/list.php @@ -19,6 +19,8 @@ echo "\tAddress: " . $a['address'] . "\n"; echo "\tState: " . $a['state'] . "\n"; echo "\tPlayers: " . $a['players'] . "\n"; + echo "\tMap: " . $a['map'] . "\n"; + echo "\tMods: " . $a['mods'] . "\n"; echo "\tTTL: " . ($stale - (time() - $a['ts'])) . "\n"; } diff --git a/web/master/ping.php b/web/master/ping.php index 17c6e77403..0317bc2cc0 100644 --- a/web/master/ping.php +++ b/web/master/ping.php @@ -17,7 +17,9 @@ '\'' . sqlite_escape_string( $addr ) . '\', '. sqlite_escape_string( $_REQUEST['players'] ) . ', '. sqlite_escape_string( $_REQUEST['state'] ) . ', '. - time() . ')'; + time() . ', '. + '\'' . sqlite_escape_string( $_REQUEST['map'] ) . '\', '. + '\'' . sqlite_escape_string( $_REQUEST['mods'] ) . '\')'; echo $q;