fix brain-o in new dtime algorithm

don't actually run the checking loop if there's nothing to do!
otherwise it spins the CPU at 100% for no reason
This commit is contained in:
Vanessa Ezekowitz 2015-02-28 11:46:18 -05:00
parent 93a439638e
commit 3de5c62d87

View File

@ -425,7 +425,8 @@ end)
-- "Play" them back, populating them with new stuff in the process
minetest.register_globalstep(function(dtime)
if dtime < 0.2 then -- don't attempt to populate if lag is already too high
if dtime < 0.2 and -- don't attempt to populate if lag is already too high
(#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) then
plantslib.globalstep_start_time = minetest.get_us_time()
plantslib.globalstep_runtime = 0
while plantslib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS.