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:
Caleb Anderson
2010-10-04 02:30:04 -05:00
committed by Paul Chote
parent 06b20c8ba5
commit 7bdf6a953f
9 changed files with 184 additions and 126 deletions

10
OpenRA.FileFormats/Exts.cs Normal file → Executable file
View 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;
}
}
}