From ec3cb2d1d75aa9dd33360037ccfccbb32c854642 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 24 Feb 2011 18:25:19 +0200 Subject: [PATCH] fixed a possible infinite loop in ClientEnvironment (dtime counter getting so small that it doesn't increment the value) --- src/environment.cpp | 12 +++++++++++- src/main.cpp | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/environment.cpp b/src/environment.cpp index 2c9f4d68..7f3687c3 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -808,10 +808,20 @@ void ClientEnvironment::step(float dtime) f32 dtime_part; if(dtime_downcount > dtime_max_increment) + { dtime_part = dtime_max_increment; + dtime_downcount -= dtime_part; + } else + { dtime_part = dtime_downcount; - dtime_downcount -= dtime_part; + /* + Setting this to 0 (no -=dtime_part) disables an infinite loop + when dtime_part is so small that dtime_downcount -= dtime_part + does nothing + */ + dtime_downcount = 0; + } /* Handle local player diff --git a/src/main.cpp b/src/main.cpp index a74685fa..2c059840 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -254,7 +254,6 @@ Doing now (most important at the top): === Next * Continue making the scripting system: - * Rip up everything unnecessary from the lua build system * Make updateNodeMesh for a less verbose mesh update on add/removenode * Switch to using a safe way for the self and env pointers * Make some global environment hooks, like node placed and general -- 2.30.2