From 0112bc4df76eafd3022afc55b24dc2d8f6b451d1 Mon Sep 17 00:00:00 2001 From: geckosoft Date: Mon, 1 Nov 2010 05:07:45 +0100 Subject: [PATCH] Added : Some missing changes to make WorldGameOver work (ie missing RejoinLobby etc) Warning: Please add the following manually (if you cant find it): in Game.cs find 'case ConnectionState.Connected:' add if (ConnectedToLobby != null) ConnectedToLobby(); Tried my best to add it in the patch but it failed :( --- OpenRA.Game/Game.cs | 37 +++++++++++++++++++++++++++- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 95fe03914c..57bad26216 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; +using System.Net; using System.Windows.Forms; using OpenRA.FileFormats; using OpenRA.GameRules; @@ -153,6 +154,7 @@ namespace OpenRA } internal static event Action LobbyInfoChanged = () => { }; + internal static event Action ConnectedToLobby = () => { }; internal static void SyncLobbyInfo() { @@ -174,7 +176,6 @@ namespace OpenRA Widget.SelectedWidget = null; orderManager.LocalFrameNumber = 0; - orderManager.StartGame(); worldRenderer.RefreshPalette(); AfterGameStart( orderManager.world ); @@ -343,5 +344,39 @@ namespace OpenRA { return modData.ObjectCreator.CreateObject( name ); } + + public static void RejoinLobby(World world) + { + if (Game.IsHost && Game.Settings.Server.Extension != null) + Game.Settings.Server.Extension.OnRejoinLobby(world); + + var map = orderManager.LobbyInfo.GlobalSettings.Map; + var host = orderManager.Host; + var port = orderManager.Port; + var isHost = Game.IsHost; + + Disconnect(); + ConnectedToLobby += () => + { + if (world.LocalPlayer != null) + { + /* Try to get back the old slot */ + Game.orderManager.IssueOrder(Order.Command("race " + world.LocalPlayer.Country.Race)); + Game.orderManager.IssueOrder(Order.Command("slot " + world.LobbyInfo.ClientWithIndex(world.LocalPlayer.ClientIndex).Slot)); + }else /* a spectator */ + { + Game.orderManager.IssueOrder(Order.Command("spectator")); + } + + ConnectedToLobby = null; + }; + if (isHost) + { + Server.Server.ServerMain(Game.modData, Settings, map); + JoinServer(IPAddress.Loopback.ToString(), Settings.Server.ListenPort); + } + else + JoinServer(host, port); + } } } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 19940586ef..f97ff9ef97 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -276,6 +276,7 @@ +