Merge pull request #8380 from reaperrr/color-valid-tweak

Less permissive color validator
This commit is contained in:
Oliver Brakmann
2015-06-08 19:50:02 +02:00

View File

@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Server
public class ColorValidator : ServerTrait, IClientJoined
{
// The bigger the color threshold, the less permitive is the algorithm
const int ColorThreshold = 0x40;
const byte ColorLowerBound = 0x33;
const int ColorThreshold = 0x70;
const byte ColorLowerBound = 0x80;
const byte ColorHigherBound = 0xFF;
static bool ValidateColorAgainstForbidden(Color askedColor, IEnumerable<Color> forbiddenColors, out Color forbiddenColor)
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Server
{
var hue = (byte)server.Random.Next(255);
var sat = (byte)server.Random.Next(255);
var lum = (byte)server.Random.Next(51, 255);
var lum = (byte)server.Random.Next(129, 255);
askColor = new HSLColor(hue, sat, lum);
} while (!ValidatePlayerNewColor(server, askColor.RGB, playerIndex));
}