From 83a95a04886cba4845858e91aba1a85c6af0fe9a Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sat, 28 May 2011 10:17:19 +0200 Subject: [PATCH] (Re)fix bug #285, textranslate broken Due to fingertrouble, I removed the check for _step == 0 which this patch re-adds. Also, make this function look more like a template by not using 0.0 - constants. --- simgear/structure/SGExpression.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/simgear/structure/SGExpression.hxx b/simgear/structure/SGExpression.hxx index 1f599b76..a2525fc7 100644 --- a/simgear/structure/SGExpression.hxx +++ b/simgear/structure/SGExpression.hxx @@ -665,12 +665,14 @@ public: private: T apply_mods(T property) const { + if( _step <= SGLimits::min() ) return property; + // apply stepping of input value T modprop = floor(property/_step)*_step; // calculate scroll amount (for odometer like movement) - T remainder = property < 0 ? -fmod(property,_step) : (_step - fmod(property,_step)); - if( remainder > 0.0 && remainder < _scroll ) + T remainder = property <= SGLimits::min() ? -fmod(property,_step) : (_step - fmod(property,_step)); + if( remainder > SGLimits::min() && remainder < _scroll ) modprop += (_scroll - remainder) / _scroll * _step; return modprop; -- 2.39.5