fix crash wrt chat in lobby

This commit is contained in:
Bob
2010-10-12 20:32:33 +13:00
parent 7ca9fcdac9
commit 6b6c9639f9
2 changed files with 5 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Network
public Client ClientWithIndex( int clientID ) public Client ClientWithIndex( int clientID )
{ {
return Clients.Single( c => c.Index == clientID ); return Clients.SingleOrDefault( c => c.Index == clientID );
} }
public Client ClientInSlot( Slot slot ) public Client ClientInSlot( Slot slot )

View File

@@ -36,14 +36,10 @@ namespace OpenRA.Network
case "Chat": case "Chat":
{ {
var client = orderManager.LobbyInfo.ClientWithIndex( clientId ); var client = orderManager.LobbyInfo.ClientWithIndex( clientId );
if (client != null) if( client != null )
{ Game.AddChatLine( client.Color1, client.Name, order.TargetString );
var player = world.FindPlayerByClientId(clientId); else
if (player != null && player.WinState == WinState.Lost) Game.AddChatLine( Color.White, "(player {0})".F( clientId ), order.TargetString );
Game.AddChatLine(client.Color1, client.Name + " (Dead)", order.TargetString);
else
Game.AddChatLine(client.Color1, client.Name, order.TargetString);
}
break; break;
} }
case "TeamChat": case "TeamChat":