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

@@ -51,11 +51,10 @@ namespace OpenRA.Mods.Cnc.Widgets
multiplayerMenu.GetWidget("JOIN_BUTTON").OnMouseUp = mi =>
{
Menu = MenuType.None;
Widget.OpenWindow("SERVERBROWSER_PANEL",
new Dictionary<string, object>()
{
{"onExit", new Action(() => {Menu = MenuType.Multiplayer; Widget.CloseWindow();})}
});
Widget.OpenWindow("SERVERBROWSER_PANEL", new Dictionary<string, object>()
{
{"onExit", new Action(() => {Menu = MenuType.Multiplayer; Widget.CloseWindow();})}
});
return true;
};
@@ -77,6 +76,28 @@ namespace OpenRA.Mods.Cnc.Widgets
settings.Server.ListenPort = 1234;
settings.Server.ExternalPort = 1234;
Game.CreateAndJoinServer(settings, map);
Menu = MenuType.None;
Game.OpenWindow("SERVER_LOBBY", new Dictionary<string, object>()
{
// Returning to main menu
{"onExit", new Action(() =>
{
Game.DisconnectOnly();
Menu = MenuType.Main;
Widget.CloseWindow();
})
},
// Starting a game: remove all shellmap ui
{"onStart", new Action(() =>
{
Widget.CloseWindow();
Widget.RootWidget.RemoveChild(Widget.RootWidget.GetWidget("MENU_BACKGROUND"));
})
}
});
}
}
}