diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-01-03 13:49:47 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-01-03 13:49:47 +0200 |
commit | f9d7e399b23999b4ecec505537efe29fc0cf4fd0 (patch) | |
tree | 67b3aec9648ed539d37e8baa03d5ead635db811b | |
parent | 3e6f824e6cb8e765d691d074077f9aac87fd0931 (diff) | |
download | minetest-f9d7e399b23999b4ecec505537efe29fc0cf4fd0.tar.gz minetest-f9d7e399b23999b4ecec505537efe29fc0cf4fd0.tar.bz2 minetest-f9d7e399b23999b4ecec505537efe29fc0cf4fd0.zip |
Limit range of ABM timer initial value randomization
-rw-r--r-- | src/environment.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 20ecaff14..3a294086c 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); } /* |