aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-06-16 19:43:28 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-06-16 19:43:28 +0300
commitd6b54514bfddac3a2b3fe2a1729b822a79a2e99a (patch)
tree9ee9810c81cecdd426b8b2bea79fc9681eee65a3
parent1d372b92730b17cacb01400fca2f3dadc5b8d388 (diff)
downloadminetest-d6b54514bfddac3a2b3fe2a1729b822a79a2e99a.tar.gz
minetest-d6b54514bfddac3a2b3fe2a1729b822a79a2e99a.tar.bz2
minetest-d6b54514bfddac3a2b3fe2a1729b822a79a2e99a.zip
hopefully fixed old furnaces taking ridiculous amounts of cpu and halting the server
-rw-r--r--src/nodemetadata.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp
index f9468e4fa..6822173cb 100644
--- a/src/nodemetadata.cpp
+++ b/src/nodemetadata.cpp
@@ -299,7 +299,11 @@ bool FurnaceNodeMetadata::step(float dtime)
m_src_time = 0;
m_src_totaltime = 0;
}
-
+
+ /*
+ If fuel is burning, increment the burn counters.
+ If item finishes cooking, move it to result.
+ */
if(m_fuel_time < m_fuel_totaltime)
{
//dstream<<"Furnace is active"<<std::endl;
@@ -318,9 +322,13 @@ bool FurnaceNodeMetadata::step(float dtime)
continue;
}
+ /*
+ If there is no source item or source item is not cookable, stop loop.
+ */
if(src_item == NULL || m_src_totaltime < 0.001)
{
- continue;
+ m_step_accumulator = 0;
+ break;
}
//dstream<<"Furnace is out of fuel"<<std::endl;
@@ -360,6 +368,9 @@ bool FurnaceNodeMetadata::step(float dtime)
else
{
//dstream<<"No fuel found"<<std::endl;
+ // No fuel, stop loop.
+ m_step_accumulator = 0;
+ break;
}
}
return changed;