From eed22675687549362e5a703bf0c1b86fc6fa7958 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 17 Mar 2010 21:19:47 +1300 Subject: [PATCH] fixing lobby bits --- OpenRA.Game/Chrome.cs | 10 +++++----- OpenRA.Game/Game.cs | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Chrome.cs b/OpenRA.Game/Chrome.cs index c15e237426..819335a787 100644 --- a/OpenRA.Game/Chrome.cs +++ b/OpenRA.Game/Chrome.cs @@ -386,9 +386,9 @@ namespace OpenRA { var d = left ? +1 : Player.PlayerColors.Count() - 1; - var newIndex = ((int)Game.world.LocalPlayer.PaletteIndex + d) % Player.PlayerColors.Count(); + var newIndex = ((int)Game.LocalClient.PaletteIndex + d) % Player.PlayerColors.Count(); - while (!PaletteAvailable(newIndex) && newIndex != (int)Game.world.LocalPlayer.PaletteIndex) + while (!PaletteAvailable(newIndex) && newIndex != (int)Game.LocalClient.PaletteIndex) newIndex = (newIndex + d) % Player.PlayerColors.Count(); Game.IssueOrder( @@ -399,7 +399,7 @@ namespace OpenRA { var countries = Game.world.GetCountries(); var nextCountry = countries.Concat(countries) - .SkipWhile(c => c != Game.world.LocalPlayer.Country) + .SkipWhile(c => c.Name != Game.LocalClient.Country) .Skip(1) .First(); @@ -416,9 +416,9 @@ namespace OpenRA { var d = left ? +1 : Game.world.Map.SpawnPoints.Count(); - var newIndex = (Game.world.LocalPlayer.SpawnPointIndex + d) % (Game.world.Map.SpawnPoints.Count()+1); + var newIndex = (Game.LocalClient.SpawnPoint + d) % (Game.world.Map.SpawnPoints.Count()+1); - while (!SpawnPointAvailable(newIndex) && newIndex != (int)Game.world.LocalPlayer.SpawnPointIndex) + while (!SpawnPointAvailable(newIndex) && newIndex != (int)Game.LocalClient.SpawnPoint) newIndex = (newIndex + d) % (Game.world.Map.SpawnPoints.Count()+1); Game.IssueOrder( diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 9f8233286b..62fdcf79ff 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -311,6 +311,11 @@ namespace OpenRA get { return orderManager.Connection.LocalClientId == 0; } } + public static Session.Client LocalClient + { + get { return LobbyInfo.Clients.FirstOrDefault(c => c.Index == orderManager.Connection.LocalClientId); } + } + public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers ) { int sync = Game.world.SyncHash();