Replace ColorRamp with HSLColor everywhere.

Fixes:
* Nuclear-purple color exploit.
* #3247.
* Removes a bunch of unnecessary color conversions every frame.

Caveats:
* The ramp range is now defined on the palette, so ramps can no longer be set per-player (may impact maps which define custom colors).
* It's no longer possible to perfectly recreate the original WW color ramps (I doubt we care).
* The old ColorRamp setting isn't migrated, so players will lose their color settings.
This commit is contained in:
Paul Chote
2013-05-10 17:14:22 +12:00
parent abcc30f0b7
commit 656476991f
41 changed files with 112 additions and 168 deletions

View File

@@ -225,7 +225,7 @@ namespace OpenRA.Mods.RA.Server
var hue = (byte)server.Random.Next(255);
var sat = (byte)server.Random.Next(255);
var lum = (byte)server.Random.Next(51,255);
bot.ColorRamp = bot.PreferredColorRamp = new ColorRamp(hue, sat, lum, 10);
bot.Color = bot.PreferredColor = new HSLColor(hue, sat, lum);
server.lobbyInfo.Clients.Add(bot);
}
@@ -520,7 +520,7 @@ namespace OpenRA.Mods.RA.Server
return true;
var ci = parts[1].Split(',').Select(cc => int.Parse(cc)).ToArray();
targetClient.ColorRamp = targetClient.PreferredColorRamp = new ColorRamp((byte)ci[0], (byte)ci[1], (byte)ci[2], (byte)ci[3]);
targetClient.Color = targetClient.PreferredColor = new HSLColor((byte)ci[0], (byte)ci[1], (byte)ci[2]);
server.SyncLobbyInfo();
return true;
}}