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
11
OpenRA.Game/Server/Exts.cs
Normal file → Executable file
11
OpenRA.Game/Server/Exts.cs
Normal file → Executable file
@@ -11,6 +11,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Server
|
||||
{
|
||||
@@ -32,5 +33,15 @@ namespace OpenRA.Server
|
||||
{
|
||||
return ts.Except( new[] { t } );
|
||||
}
|
||||
|
||||
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