17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 02:49:19 +02:00

fix: keep quantize() in its own value type

The S5276 change cast the result of the generic quantize<Type_>() to
unsigned int, which truncated float/double callers (shadow angle slider,
editor rotation snapping, AI speed control steps) and broke negative values.
This commit is contained in:
jerrrrycho
2026-10-11 01:40:23 +02:00
parent dbd37798ae
commit 457569e8ac

View File

@@ -314,7 +314,7 @@ template <typename T> T clamp_power_of_two(T Value, T const Min = T(1), T const
template <typename Type_> Type_ quantize(Type_ const Value, Type_ const Step) template <typename Type_> Type_ quantize(Type_ const Value, Type_ const Step)
{ {
return static_cast<unsigned int>(Step * std::round(Value / Step)); return static_cast<Type_>(Step * std::round(Value / Step));
} }
template <typename T> T min_speed(T const Left, T const Right) template <typename T> T min_speed(T const Left, T const Right)