Don't assert() in to_float(), just clamp the return value

Fixes #120 might still be worth to investigate why the values go out of range in the first place
This commit is contained in:
Ingo Ruhnke 2015-11-09 11:14:02 +01:00
parent 0332697159
commit 605e45ede0

View file

@ -155,10 +155,9 @@ float to_float_no_range_check(int value, int min, int max)
float to_float(int value, int min, int max)
{
assert(value >= min);
assert(value <= max);
return to_float_no_range_check(value, min, max);
return Math::clamp(-1.0f,
to_float_no_range_check(value, min, max),
1.0f);
}
int from_float(float value, int min, int max)