projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3e6f824
)
Limit range of ABM timer initial value randomization
author
Perttu Ahola
<celeron55@gmail.com>
Tue, 3 Jan 2012 11:49:47 +0000
(13:49 +0200)
committer
Perttu Ahola
<celeron55@gmail.com>
Tue, 3 Jan 2012 11:49:47 +0000
(13:49 +0200)
src/environment.cpp
patch
|
blob
|
history
diff --git
a/src/environment.cpp
b/src/environment.cpp
index 20ecaff14d1fd3b54fd1e48a710c7e5f82a53749..3a294086c8ac78a6ee19b9bce7cff7a17868a76c 100644
(file)
--- 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);
}
/*