From: Perttu Ahola Date: Tue, 3 Jan 2012 11:49:47 +0000 (+0200) Subject: Limit range of ABM timer initial value randomization X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=f9d7e399b23999b4ecec505537efe29fc0cf4fd0;p=zefram%2Fminetest%2Fminetest_engine.git Limit range of ABM timer initial value randomization --- diff --git a/src/environment.cpp b/src/environment.cpp index 20ecaff1..3a294086 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -213,7 +213,10 @@ ABMWithState::ABMWithState(ActiveBlockModifier *abm_): { // Initialize timer to random value to spread processing float itv = abm->getTriggerInterval(); - timer = myrand_range(-0.51*itv, 0.51*itv); + itv = MYMAX(0.001, itv); // No less than 1ms + int minval = MYMAX(-0.51*itv, -60); // Clamp to + int maxval = MYMIN(0.51*itv, 60); // +-60 seconds + timer = myrand_range(minval, maxval); } /*