Per-terrain color validation.

This commit is contained in:
Paul Chote
2016-01-25 22:38:37 +00:00
parent cc4ca839d9
commit dd963b75f5
14 changed files with 49 additions and 2 deletions

View File

@@ -291,7 +291,7 @@ namespace OpenRA.Mods.Common.Server
// Pick a random color for the bot
var validator = server.ModData.Manifest.Get<ColorValidator>();
var tileset = server.Map.Rules.TileSets[server.Map.Tileset];
var terrainColors = tileset.TerrainInfo.Select(ti => ti.Color);
var terrainColors = tileset.TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color);
var playerColors = server.LobbyInfo.Clients.Select(c => c.Color.RGB)
.Concat(server.MapPlayers.Players.Values.Select(p => p.Color.RGB));
bot.Color = bot.PreferredColor = validator.RandomValidColor(server.Random, terrainColors, playerColors);
@@ -975,7 +975,7 @@ namespace OpenRA.Mods.Common.Server
};
var tileset = server.Map.Rules.TileSets[server.Map.Tileset];
var terrainColors = tileset.TerrainInfo.Select(ti => ti.Color).ToList();
var terrainColors = tileset.TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color).ToList();
var playerColors = server.LobbyInfo.Clients.Where(c => c.Index != playerIndex).Select(c => c.Color.RGB)
.Concat(server.MapPlayers.Players.Values.Select(p => p.Color.RGB)).ToList();