aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-09 23:06:24 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-09 23:06:24 +0300
commit8ed74a342988b7d67a7c9eacc2257ba42acd00de (patch)
tree4b7854973c0b678540d1b4f8eabb968e0fc21dde /src
parent07a5e59ae72cca5a8e58dca7210e5992d8e9d527 (diff)
downloadminetest-8ed74a342988b7d67a7c9eacc2257ba42acd00de.tar.gz
minetest-8ed74a342988b7d67a7c9eacc2257ba42acd00de.tar.bz2
minetest-8ed74a342988b7d67a7c9eacc2257ba42acd00de.zip
Fix ABM handling on block activation
Diffstat (limited to 'src')
-rw-r--r--src/environment.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index e1f5bb3fb..43dbb65d0 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -633,13 +633,15 @@ public:
i->timer -= trigger_interval;
actual_interval = trigger_interval;
}
- ActiveABM aabm;
- aabm.abm = abm;
float intervals = actual_interval / trigger_interval;
+ if(intervals == 0)
+ continue;
float chance = abm->getTriggerChance();
if(chance == 0)
chance = 1;
- aabm.chance = 1.0 / pow((float)1.0/chance, (float)intervals);
+ ActiveABM aabm;
+ aabm.abm = abm;
+ aabm.chance = chance / intervals;
if(aabm.chance == 0)
aabm.chance = 1;
// Trigger neighbors