Can now start a game and disconnect from lobby without triggering a reload.

It is now possible to crash the game by starting a new server before the previous one has had time to timeout and release the port binding (the previous loadscreen pause meant this was always hidden).
This commit is contained in:
Paul Chote
2011-05-06 23:18:26 +12:00
parent 03264fa2ca
commit 6cb0cb7d0e
9 changed files with 590 additions and 19 deletions

View File

@@ -100,6 +100,18 @@ namespace OpenRA
{
return Widget.OpenWindow(widget, new Dictionary<string,object>{{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }});
}
// Who came up with the great idea of making these things
// impossible for the things that want them to access them directly?
public static Widget OpenWindow(string widget, Dictionary<string, object> args)
{
return Widget.OpenWindow(widget, new Dictionary<string,object>(args)
{
{ "world", worldRenderer.world },
{ "orderManager", orderManager },
{ "worldRenderer", worldRenderer },
});
}
static ActionQueue afterTickActions = new ActionQueue();
public static void RunAfterTick(Action a) { afterTickActions.Add(a); }
@@ -316,19 +328,27 @@ namespace OpenRA
{
AddChatLine(Color.White, "Debug", String.Format(s,args));
}
// TODO: Fix ra relying on this behavior, then make this sane
public static void Disconnect()
{
DisconnectOnly();
var shellmap = ChooseShellmap();
StartGame(shellmap);
}
public static void DisconnectOnly()
{
if (orderManager.world != null)
orderManager.world.traitDict.PrintReport();
if (IsHost && server != null)
{
Console.WriteLine("Closing server");
server.Shutdown();
orderManager.Dispose();
var shellmap = ChooseShellmap();
}
JoinLocal();
StartGame(shellmap);
orderManager.Dispose();
}
public static T CreateObject<T>( string name )