From 3d9d44cf73c751854322982294183d88ad8b8aca Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 5 Jan 2016 23:18:41 -0600 Subject: [PATCH] Fix negative loop counts when dt is small. --- simgear/structure/subsystem_mgr.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx index 5e26a432..b01a0ffe 100644 --- a/simgear/structure/subsystem_mgr.cxx +++ b/simgear/structure/subsystem_mgr.cxx @@ -234,6 +234,7 @@ SGSubsystemGroup::update (double delta_time_sec) if ((delta_time_sec > 0.0) && (_fixedUpdateTime > 0.0)) { double localDelta = delta_time_sec + _updateTimeRemainder; loopCount = SGMiscd::roundToInt(localDelta / _fixedUpdateTime); + loopCount = std::max(0, loopCount); _updateTimeRemainder = delta_time_sec - (loopCount * _fixedUpdateTime); delta_time_sec = _fixedUpdateTime; } -- 2.39.5