Added ability to join a server on startup, for gamelist apps.

This commit is contained in:
Christer Ulfsparre
2011-10-22 00:33:23 +02:00
committed by Chris Forbes
parent c0b5455016
commit dec8c8ba4b
4 changed files with 25 additions and 1 deletions

View File

@@ -388,5 +388,22 @@ namespace OpenRA
{
return orderManager != null && orderManager.world == world;
}
public static void JoinExternalGame()
{
var addressParts = Game.Settings.Game.ConnectTo.Split(
new [] { ':' }, StringSplitOptions.RemoveEmptyEntries);
if (addressParts.Length < 1 || addressParts.Length > 2)
return;
var host = addressParts[0];
var port = Exts.WithDefault(1234, () => int.Parse(addressParts[1]));
Game.Settings.Game.ConnectTo = "";
Game.Settings.Save();
Game.JoinServer(host, port);
}
}
}