Added ability to join a server on startup, for gamelist apps.
This commit is contained in:
committed by
Chris Forbes
parent
c0b5455016
commit
dec8c8ba4b
@@ -388,5 +388,22 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
return orderManager != null && orderManager.world == world;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
// Internal game settings
|
// Internal game settings
|
||||||
public int Timestep = 40;
|
public int Timestep = 40;
|
||||||
|
|
||||||
|
public string ConnectTo = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Settings
|
public class Settings
|
||||||
|
|||||||
@@ -115,7 +115,11 @@ namespace OpenRA.Mods.Cnc
|
|||||||
r.EndFrame(nih);
|
r.EndFrame(nih);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGame() { TestAndContinue(); }
|
public void StartGame()
|
||||||
|
{
|
||||||
|
TestAndContinue();
|
||||||
|
Game.JoinExternalGame();
|
||||||
|
}
|
||||||
|
|
||||||
void TestAndContinue()
|
void TestAndContinue()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ namespace OpenRA.Mods.RA
|
|||||||
};
|
};
|
||||||
|
|
||||||
TestAndContinue();
|
TestAndContinue();
|
||||||
|
Game.JoinExternalGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestAndContinue()
|
void TestAndContinue()
|
||||||
|
|||||||
Reference in New Issue
Block a user