diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 82d1ba2360..a9ddcffa4b 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -103,6 +103,20 @@ namespace OpenRA static void JoinLocal() { JoinInner(new OrderManager(new EchoConnection())); + + // Add a spectator client for the local player + // On the shellmap this player is controlling the map via scripted orders + OrderManager.LobbyInfo.Clients.Add(new Session.Client + { + Index = OrderManager.Connection.LocalClientId, + Name = Settings.Player.Name, + PreferredColor = Settings.Player.Color, + Color = Settings.Player.Color, + Faction = "Random", + SpawnPoint = 0, + Team = 0, + State = Session.ClientState.Ready + }); } // More accurate replacement for Environment.TickCount @@ -484,27 +498,13 @@ namespace OpenRA public static void LoadEditor(string mapUid) { + JoinLocal(); StartGame(mapUid, WorldType.Editor); } public static void LoadShellMap() { var shellmap = ChooseShellmap(); - - // Add a spectator client for the local player, - // who is controlling the map via scripted orders - OrderManager.LobbyInfo.Clients.Add(new Session.Client - { - Index = OrderManager.Connection.LocalClientId, - Name = Settings.Player.Name, - PreferredColor = Settings.Player.Color, - Color = Settings.Player.Color, - Faction = "Random", - SpawnPoint = 0, - Team = 0, - State = Session.ClientState.Ready - }); - using (new PerfTimer("StartGame")) { StartGame(shellmap, WorldType.Shellmap); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index a1418d5940..e2fda1881e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -343,10 +343,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic void LoadMapIntoEditor(string uid) { - ConnectionLogic.Connect(Game.CreateLocalServer(uid), - "", - () => { Game.LoadEditor(uid); }, - () => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); }); + Game.LoadEditor(uid); DiscordService.UpdateStatus(DiscordState.InMapEditor);