replace ridiculous GetSpawnColors function with something tidier

This commit is contained in:
Chris Forbes
2011-10-18 20:23:10 +13:00
parent 50010faf58
commit 0f7a744ef7

View File

@@ -121,17 +121,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
public static Dictionary<int2, Color> GetSpawnColors(OrderManager orderManager, Map map)
{
var spawns = Map.SpawnPoints;
var sc = new Dictionary<int2, Color>();
for (int i = 1; i <= spawns.Count(); i++)
{
var client = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.SpawnPoint == i);
if (client == null)
continue;
sc.Add(spawns.ElementAt(i - 1), client.ColorRamp.GetColor(0));
}
return sc;
return orderManager.LobbyInfo.Clients
.Where( c => c.SpawnPoint != 0 )
.ToDictionary(
c => Map.SpawnPoints.ElementAt( c.SpawnPoint - 1 ),
c => c.ColorRamp.GetColor(0));
}
}
}