diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-02-24 18:25:19 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-02-24 18:25:19 +0200 |
commit | ec3cb2d1d75aa9dd33360037ccfccbb32c854642 (patch) | |
tree | 8b145438a5559b1cf7c51e9a0185ba1247550519 /src/environment.cpp | |
parent | 9f859d838937136703b3e5993f4148ef93b459e9 (diff) | |
download | minetest-ec3cb2d1d75aa9dd33360037ccfccbb32c854642.tar.gz minetest-ec3cb2d1d75aa9dd33360037ccfccbb32c854642.tar.bz2 minetest-ec3cb2d1d75aa9dd33360037ccfccbb32c854642.zip |
fixed a possible infinite loop in ClientEnvironment (dtime counter getting so small that it doesn't increment the value)
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 2c9f4d68f..7f3687c3c 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 |