diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/environment.cpp | 13 | ||||
-rw-r--r-- | src/environment.h | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 53a7fdf9b..20ecaff14 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -204,6 +204,19 @@ u32 Environment::getDayNightRatio() } /* + ABMWithState +*/ + +ABMWithState::ABMWithState(ActiveBlockModifier *abm_): + abm(abm_), + timer(0) +{ + // Initialize timer to random value to spread processing + float itv = abm->getTriggerInterval(); + timer = myrand_range(-0.51*itv, 0.51*itv); +} + +/* ActiveBlockList */ diff --git a/src/environment.h b/src/environment.h index f8df77f79..beb49885c 100644 --- a/src/environment.h +++ b/src/environment.h @@ -129,10 +129,7 @@ struct ABMWithState ActiveBlockModifier *abm; float timer; - ABMWithState(ActiveBlockModifier *abm_): - abm(abm_), - timer(0) - {} + ABMWithState(ActiveBlockModifier *abm_); }; /* |