map,mods advertised in server info

This commit is contained in:
Chris Forbes
2010-03-13 13:12:53 +13:00
parent be547479ce
commit de388767ed
5 changed files with 16 additions and 14 deletions

View File

@@ -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();
}

View File

@@ -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;
}