diff --git a/OpenRA.Game/Chat.cs b/OpenRA.Game/Chat.cs index 3dacbdd1d3..54dac7264a 100644 --- a/OpenRA.Game/Chat.cs +++ b/OpenRA.Game/Chat.cs @@ -60,9 +60,9 @@ namespace OpenRA typing += c; } - public void AddLine(Player p, string text) + public void AddLine(Session.Client p, string text) { - AddLine(p.Color, p.PlayerName, text); + AddLine(Player.PlayerColors[p.PaletteIndex].c, p.Name, text); } public void AddLine(Color c, string from, string text) diff --git a/OpenRA.Game/Chrome.cs b/OpenRA.Game/Chrome.cs index 920b41e930..c15e237426 100644 --- a/OpenRA.Game/Chrome.cs +++ b/OpenRA.Game/Chrome.cs @@ -509,7 +509,7 @@ namespace OpenRA paletteRect.Bottom+Game.viewport.Location.Y - 5), Player.PlayerColors[client.PaletteIndex].c); lineRenderer.Flush(); - f.DrawText(rgbaRenderer, client.Country, new int2(r.Left + 220, y), Color.White); + f.DrawText(rgbaRenderer, client.Country ?? "Unknown", new int2(r.Left + 220, y), Color.White); f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White); f.DrawText(rgbaRenderer, (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White); y += 30; diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 309bff52b4..9f8233286b 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -238,8 +238,6 @@ namespace OpenRA var client = new Session.Client(); FieldLoader.Load(client, y.Value); session.Clients.Add(client); - - world.players[index].SyncFromLobby(client); } LobbyInfo = session; diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 15c9e64019..0d3dd77b18 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -32,8 +32,9 @@ namespace OpenRA.Network { case "Chat": { - var player = world.players.Values.Where( p => p.Index == clientId ).Single(); - Game.chat.AddLine(player, order.TargetString); + var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Index == clientId); + if (client != null) + Game.chat.AddLine(client, order.TargetString); break; } case "StartGame": diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 8d8a419199..276f4959e4 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -195,7 +195,7 @@ namespace OpenRA { if (PlayerName != client.Name) { - Game.chat.AddLine(this, "is now known as " + client.Name); + //Game.chat.AddLine(this, "is now known as " + client.Name); PlayerName = client.Name; } @@ -204,20 +204,20 @@ namespace OpenRA if (Country.Name != client.Country) { - Game.chat.AddLine(this, "is now playing {0}".F(client.Country)); + //Game.chat.AddLine(this, "is now playing {0}".F(client.Country)); Country = PlayerActor.World.GetCountries().First(c => c.Name == client.Country); } if (PaletteIndex != client.PaletteIndex) { PaletteIndex = client.PaletteIndex; - Game.chat.AddLine(this, "has changed color to {0}".F(PlayerColors[client.PaletteIndex].b)); + //Game.chat.AddLine(this, "has changed color to {0}".F(PlayerColors[client.PaletteIndex].b)); } if (SpawnPointIndex != client.SpawnPoint) { SpawnPointIndex = client.SpawnPoint; - Game.chat.AddLine(this, "has changed spawn point to {0}".F(client.SpawnPoint)); + //Game.chat.AddLine(this, "has changed spawn point to {0}".F(client.SpawnPoint)); } } } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index eaeb00d478..d1f87ad4f5 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -60,7 +60,7 @@ namespace OpenRA { localPlayerIndex = index; Game.viewport.GoToStartLocation(LocalPlayer); - Game.chat.AddLine(LocalPlayer, "is now YOU"); + //Game.chat.AddLine(LocalPlayer, "is now YOU"); } if (!string.IsNullOrEmpty(Game.Settings.PlayerName) && LocalPlayer.PlayerName != Game.Settings.PlayerName) Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName));