fixed the object update interval thingy
authorPerttu Ahola <celeron55@gmail.com>
Sun, 10 Apr 2011 20:29:36 +0000 (23:29 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 10 Apr 2011 20:29:36 +0000 (23:29 +0300)
src/environment.cpp
src/serverobject.cpp
src/utility.h

index bed47fd40d61642b84df273e4e62acabcee59f86..3f95ed9f9be7f3c71d480c084f80868f4ffc9508 100644 (file)
@@ -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)
                */
index b6015a4775d5cb692cb78f7618f72595e6d30415..87017c3907d4250f0c9f5ee6466e2af8f621bd14 100644 (file)
@@ -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;
        }
 
index 19946354c1eb6fcb280dde7cd12776e310832bf5..50bbe1496d8118d55be806df7d8618350bd4029e 100644 (file)
@@ -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;