New slider Range parameter. Palette modifications. Potential crash fix. Clamp function.
Range parameter added to slider. Supports returning a range of values rather than just 0-1. Allows you to not have to post process the offset. Modified palette selector to not have full range, which was causing blown out units. Introduced exension method Clamp<T>(min, max) Fixed crash deserializing out of bound color value using above extension.
This commit is contained in:
committed by
Paul Chote
parent
06b20c8ba5
commit
7bdf6a953f
10
OpenRA.FileFormats/Exts.cs
Normal file → Executable file
10
OpenRA.FileFormats/Exts.cs
Normal file → Executable file
@@ -85,5 +85,15 @@ namespace OpenRA
|
||||
{
|
||||
return (T[])mi.GetCustomAttributes( typeof( T ), true );
|
||||
}
|
||||
|
||||
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
|
||||
{
|
||||
if (val.CompareTo(min) < 0)
|
||||
return min;
|
||||
else if (val.CompareTo(max) > 0)
|
||||
return max;
|
||||
else
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user