fix crash on server overfill, fix another problem preventing spec slots from autofilling

This commit is contained in:
Chris Forbes
2010-12-19 18:32:56 +13:00
parent 7c76b25a44
commit c99f89c987
2 changed files with 6 additions and 3 deletions

View File

@@ -263,15 +263,18 @@ namespace OpenRA.Server
case "Chat": case "Chat":
case "TeamChat": case "TeamChat":
var fromClient = GetClient(conn);
var fromIndex = fromClient != null ? fromClient.Index : 0;
foreach (var c in conns.Except(conn).ToArray()) foreach (var c in conns.Except(conn).ToArray())
DispatchOrdersToClient(c, GetClient(conn).Index, 0, so.Serialize()); DispatchOrdersToClient(c, fromIndex, 0, so.Serialize());
break; break;
} }
} }
public Session.Client GetClient(Connection conn) public Session.Client GetClient(Connection conn)
{ {
return lobbyInfo.Clients.First(c => c.Index == conn.PlayerIndex); return lobbyInfo.ClientWithIndex(conn.PlayerIndex);
} }
public void DropClient(Connection toDrop, Exception e) public void DropClient(Connection toDrop, Exception e)

View File

@@ -285,7 +285,7 @@ namespace OpenRA.Mods.RA.Server
}; };
var slotData = server.lobbyInfo.Slots.FirstOrDefault( x => x.Index == client.Slot ); var slotData = server.lobbyInfo.Slots.FirstOrDefault( x => x.Index == client.Slot );
if (slotData != null) if (slotData != null && slotData.MapPlayer != null)
SyncClientToPlayerReference(client, server.Map.Players[slotData.MapPlayer]); SyncClientToPlayerReference(client, server.Map.Players[slotData.MapPlayer]);
server.lobbyInfo.Clients.Add(client); server.lobbyInfo.Clients.Add(client);