From 796a4a795a95ad2ffa16de61368af9257b41b9c8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 13 Feb 2016 03:09:28 +0100 Subject: [PATCH] Avoid the 'spiral of death' --- apps/openmw/mwphysics/physicssystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index ddb3d0c85..8d4c2c590 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -1295,7 +1295,11 @@ namespace MWPhysics mTimeAccum += dt; const float physicsDt = 1.f/60.0f; + + const int maxAllowedSteps = 20; int numSteps = mTimeAccum / (physicsDt); + numSteps = std::min(numSteps, maxAllowedSteps); + mTimeAccum -= numSteps * physicsDt; if (numSteps)