map,mods advertised in server info
This commit is contained in:
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
@@ -32,8 +32,6 @@ using OpenRA.Network;
|
|||||||
using OpenRA.Support;
|
using OpenRA.Support;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using Timer = OpenRA.Support.Timer;
|
using Timer = OpenRA.Support.Timer;
|
||||||
using OpenRA.Server;
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -156,11 +154,9 @@ namespace OpenRA
|
|||||||
internal static void CreateServer()
|
internal static void CreateServer()
|
||||||
{
|
{
|
||||||
// todo: LobbyInfo is the wrong place for this.
|
// todo: LobbyInfo is the wrong place for this.
|
||||||
var mods = LobbyInfo.GlobalSettings.Mods;
|
Server.Server.ServerMain(Settings.GameName, Settings.ListenPort,
|
||||||
var gameName = "{0} ({1})".F( Settings.GameName, string.Join( ",", mods ) );
|
Settings.ExternalPort, LobbyInfo.GlobalSettings.Mods);
|
||||||
|
|
||||||
Server.Server.ServerMain(gameName, Settings.ListenPort,
|
|
||||||
Settings.ExternalPort, mods);
|
|
||||||
JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort);
|
JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +383,6 @@ namespace OpenRA
|
|||||||
throw new InvalidOperationException("Unable to load MIX files.");
|
throw new InvalidOperationException("Unable to load MIX files.");
|
||||||
Directory.SetCurrentDirectory("..");
|
Directory.SetCurrentDirectory("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LoadUserSettings(settings);
|
LoadUserSettings(settings);
|
||||||
Game.LobbyInfo.GlobalSettings.Mods = Game.Settings.InitialMods;
|
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);
|
Game.Initialize(Game.Settings.Map, renderer, new int2(resolution), Game.Settings.Player, controller);
|
||||||
|
|
||||||
// ShowCursor(false);
|
|
||||||
Game.ResetTimer();
|
Game.ResetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ namespace OpenRA.Server
|
|||||||
const int DownloadChunkInterval = 20000;
|
const int DownloadChunkInterval = 20000;
|
||||||
const int DownloadChunkSize = 16384;
|
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;
|
static int lastPing = 0;
|
||||||
|
|
||||||
public static void ServerMain(string name, int port, int extport, string[] mods)
|
public static void ServerMain(string name, int port, int extport, string[] mods)
|
||||||
@@ -558,10 +559,12 @@ namespace OpenRA.Server
|
|||||||
if (wc.IsBusy) return;
|
if (wc.IsBusy) return;
|
||||||
|
|
||||||
wc.DownloadDataAsync(new Uri(
|
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),
|
ExternalPort, Uri.EscapeUriString(Name),
|
||||||
GameStarted ? 2 : 1, // todo: post-game states, etc.
|
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;
|
lastPing = Environment.TickCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
if ($db = sqlite_open('openra.db', 0666, $e))
|
if ($db = sqlite_open('openra.db', 0666, $e))
|
||||||
{
|
{
|
||||||
echo 'sqlite_open ok.';
|
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 );
|
sqlite_close( $db );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
echo "\tAddress: " . $a['address'] . "\n";
|
echo "\tAddress: " . $a['address'] . "\n";
|
||||||
echo "\tState: " . $a['state'] . "\n";
|
echo "\tState: " . $a['state'] . "\n";
|
||||||
echo "\tPlayers: " . $a['players'] . "\n";
|
echo "\tPlayers: " . $a['players'] . "\n";
|
||||||
|
echo "\tMap: " . $a['map'] . "\n";
|
||||||
|
echo "\tMods: " . $a['mods'] . "\n";
|
||||||
echo "\tTTL: " . ($stale - (time() - $a['ts'])) . "\n";
|
echo "\tTTL: " . ($stale - (time() - $a['ts'])) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
'\'' . sqlite_escape_string( $addr ) . '\', '.
|
'\'' . sqlite_escape_string( $addr ) . '\', '.
|
||||||
sqlite_escape_string( $_REQUEST['players'] ) . ', '.
|
sqlite_escape_string( $_REQUEST['players'] ) . ', '.
|
||||||
sqlite_escape_string( $_REQUEST['state'] ) . ', '.
|
sqlite_escape_string( $_REQUEST['state'] ) . ', '.
|
||||||
time() . ')';
|
time() . ', '.
|
||||||
|
'\'' . sqlite_escape_string( $_REQUEST['map'] ) . '\', '.
|
||||||
|
'\'' . sqlite_escape_string( $_REQUEST['mods'] ) . '\')';
|
||||||
|
|
||||||
echo $q;
|
echo $q;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user