fixed a possible infinite loop in ClientEnvironment (dtime counter getting so small...
authorPerttu Ahola <celeron55@gmail.com>
Thu, 24 Feb 2011 16:25:19 +0000 (18:25 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Thu, 24 Feb 2011 16:25:19 +0000 (18:25 +0200)
src/environment.cpp
src/main.cpp

index 2c9f4d68f9c732505e72b1b7bf4e1699e89c0114..7f3687c3c3e455eedbd982f26866de9e42bfc8dc 100644 (file)
@@ -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
index a74685fa2a1480878e0684b76840334dbb117454..2c059840ed2de0f5ef5ab5182e1b06687e2df7c2 100644 (file)
@@ -254,7 +254,6 @@ Doing now (most important at the top):
 \r
 === Next\r
 * Continue making the scripting system:\r
-  * Rip up everything unnecessary from the lua build system\r
   * Make updateNodeMesh for a less verbose mesh update on add/removenode\r
   * Switch to using a safe way for the self and env pointers\r
   * Make some global environment hooks, like node placed and general\r