aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-10 23:29:36 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-10 23:29:36 +0300
commitbb39795ab223ffe815d88ec0d0f9dc9a993bef67 (patch)
treeff69273a655906fb89bc8f4bb67613bc5fb82331
parent9d5ccafbb0fd79940a904b1754e820a90681facb (diff)
downloadminetest-bb39795ab223ffe815d88ec0d0f9dc9a993bef67.tar.gz
minetest-bb39795ab223ffe815d88ec0d0f9dc9a993bef67.tar.bz2
minetest-bb39795ab223ffe815d88ec0d0f9dc9a993bef67.zip
fixed the object update interval thingy
-rw-r--r--src/environment.cpp4
-rw-r--r--src/serverobject.cpp4
-rw-r--r--src/utility.h7
3 files changed, 8 insertions, 7 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index bed47fd40..3f95ed9f9 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -380,6 +380,8 @@ void ServerEnvironment::deSerializePlayers(const std::string &savedir)
void ServerEnvironment::step(float dtime)
{
DSTACK(__FUNCTION_NAME);
+
+ //TimeTaker timer("ServerEnv step");
// Get some settings
//bool free_move = g_settings.getBool("free_move");
@@ -451,6 +453,8 @@ void ServerEnvironment::step(float dtime)
if(m_object_management_interval.step(dtime, 0.5))
{
+ //TimeTaker timer("ServerEnv object management");
+
/*
Remove objects that satisfy (m_removed && m_known_by_count==0)
*/
diff --git a/src/serverobject.cpp b/src/serverobject.cpp
index b6015a477..87017c390 100644
--- a/src/serverobject.cpp
+++ b/src/serverobject.cpp
@@ -172,7 +172,7 @@ void ItemSAO::step(float dtime, Queue<ActiveObjectMessage> &messages,
assert(m_env);
const float interval = 0.2;
- if(m_move_interval.step(dtime, interval))
+ if(m_move_interval.step(dtime, interval)==false)
return;
dtime = interval;
@@ -312,7 +312,7 @@ void RatSAO::step(float dtime, Queue<ActiveObjectMessage> &messages,
if(m_is_active == false)
{
- if(m_inactive_interval.step(dtime, 0.5))
+ if(m_inactive_interval.step(dtime, 0.5)==false)
return;
}
diff --git a/src/utility.h b/src/utility.h
index 19946354c..50bbe1496 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -2033,12 +2033,9 @@ public:
{
m_accumulator += dtime;
if(m_accumulator < wanted_interval)
- {
- dtime = 0;
- return true;
- }
+ return false;
m_accumulator -= wanted_interval;
- return false;
+ return true;
}
protected:
float m_accumulator;