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();