From 88423b158a772ef8db82a5be8d211c3ad22c3c57 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 25 Feb 2010 18:59:56 +1300 Subject: [PATCH] started removing ' players exist before game starts' assumptions --- OpenRa.Game/Chrome.cs | 3 +-- OpenRa.Game/Game.cs | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 346040d42c..4690b738af 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -431,9 +431,8 @@ namespace OpenRa world.Minimap.Draw(minimapRect, true); world.Minimap.DrawSpawnPoints(minimapRect); - if (Game.world.LocalPlayer.Index == 0) + if (Game.IsHost) { - // we are host AddUiButton(new int2(r.Right - 100, r.Top + 300), "Change Map", _ => { diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index db1b55d8bc..a094dd4111 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -324,6 +324,11 @@ namespace OpenRa // throw new InvalidOperationException( "Desync in OnKeyDown" ); } + public static bool IsHost + { + get { return orderManager.Connection.LocalClientId == 0; } + } + public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers ) { int sync = Game.world.SyncHash();