lots more fixes; still doesnt work

This commit is contained in:
Chris Forbes
2010-03-17 20:28:46 +13:00
parent f6b4f70cd7
commit 16f9f5ce89
6 changed files with 11 additions and 12 deletions

View File

@@ -60,9 +60,9 @@ namespace OpenRA
typing += c; 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) public void AddLine(Color c, string from, string text)

View File

@@ -509,7 +509,7 @@ namespace OpenRA
paletteRect.Bottom+Game.viewport.Location.Y - 5), paletteRect.Bottom+Game.viewport.Location.Y - 5),
Player.PlayerColors[client.PaletteIndex].c); Player.PlayerColors[client.PaletteIndex].c);
lineRenderer.Flush(); 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.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); f.DrawText(rgbaRenderer, (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
y += 30; y += 30;

View File

@@ -238,8 +238,6 @@ namespace OpenRA
var client = new Session.Client(); var client = new Session.Client();
FieldLoader.Load(client, y.Value); FieldLoader.Load(client, y.Value);
session.Clients.Add(client); session.Clients.Add(client);
world.players[index].SyncFromLobby(client);
} }
LobbyInfo = session; LobbyInfo = session;

View File

@@ -32,8 +32,9 @@ namespace OpenRA.Network
{ {
case "Chat": case "Chat":
{ {
var player = world.players.Values.Where( p => p.Index == clientId ).Single(); var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Index == clientId);
Game.chat.AddLine(player, order.TargetString); if (client != null)
Game.chat.AddLine(client, order.TargetString);
break; break;
} }
case "StartGame": case "StartGame":

View File

@@ -195,7 +195,7 @@ namespace OpenRA
{ {
if (PlayerName != client.Name) 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; PlayerName = client.Name;
} }
@@ -204,20 +204,20 @@ namespace OpenRA
if (Country.Name != client.Country) 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); Country = PlayerActor.World.GetCountries().First(c => c.Name == client.Country);
} }
if (PaletteIndex != client.PaletteIndex) if (PaletteIndex != client.PaletteIndex)
{ {
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) if (SpawnPointIndex != client.SpawnPoint)
{ {
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));
} }
} }
} }

View File

@@ -60,7 +60,7 @@ namespace OpenRA
{ {
localPlayerIndex = index; localPlayerIndex = index;
Game.viewport.GoToStartLocation(LocalPlayer); 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) if (!string.IsNullOrEmpty(Game.Settings.PlayerName) && LocalPlayer.PlayerName != Game.Settings.PlayerName)
Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName)); Game.IssueOrder(Order.Chat("/name " + Game.Settings.PlayerName));