Disable the button/order when there aren't enough clients to assign

This commit is contained in:
Scott_NZ
2013-03-11 00:29:23 +13:00
parent 8c46b421de
commit 7af91f1747
2 changed files with 7 additions and 3 deletions

View File

@@ -333,15 +333,18 @@ namespace OpenRA.Mods.RA.Server
server.SendChatTo(conn, "Number of teams could not be parsed: {0}".F(s));
return true;
}
teams = teams.Clamp(2, 8);
var clients = server.lobbyInfo.Slots
.Select(slot => server.lobbyInfo.Clients.SingleOrDefault(c => c.Slot == slot.Key))
.Where(c => c != null && !server.lobbyInfo.Slots[c.Slot].LockTeam).ToArray();
if (clients.Length < 2)
{
server.SendChatTo(conn, "Not enough clients to assign teams");
return true;
}
var teamSizes = new int[clients.Length];
for (var i = 0; i < clients.Length; i++)
teamSizes[i % teams]++;