[Orxonox-commit 1611] r6329 - code/branches/presentation2/src/orxonox/items

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Dec 12 19:54:12 CET 2009


Author: rgrieder
Date: 2009-12-12 19:54:12 +0100 (Sat, 12 Dec 2009)
New Revision: 6329

Modified:
   code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
   code/branches/presentation2/src/orxonox/items/MultiStateEngine.h
Log:
Who the hell uses ints to synchronise part of a float vector? Well, I really don't know...

Modified: code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc
===================================================================
--- code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc	2009-12-12 18:08:51 UTC (rev 6328)
+++ code/branches/presentation2/src/orxonox/items/MultiStateEngine.cc	2009-12-12 18:54:12 UTC (rev 6329)
@@ -70,7 +70,7 @@
             this->lua_ = 0;
         }
         this->state_ = 0;
-        this->steeringDirectionZ_ = 0;
+        this->steeringDirectionZ_ = 0.0;
 
         this->setSyncMode(ObjectDirection::Bidirectional);
         this->registerVariables();
@@ -114,13 +114,13 @@
         if (this->getShip())
         {
             if (this->getShip()->hasLocalController())
-                this->steeringDirectionZ_ = (int)this->getDirection().z;
+                this->steeringDirectionZ_ = this->getDirection().z;
             if (GameMode::isMaster())
             {
                 const Vector3& velocity = this->getShip()->getLocalVelocity();
 
                 float pitch = velocity.length();
-                bool forward = (this->steeringDirectionZ_ < 0 && velocity.z < -FORWARD_EFFECT_VELOCITY_THRESHOLD);
+                bool forward = (this->steeringDirectionZ_ < 0.0 && velocity.z < -FORWARD_EFFECT_VELOCITY_THRESHOLD);
 
                 int newState = 0;
                 if (this->getShip()->getBoost() && forward)
@@ -133,7 +133,7 @@
                     newState = Normal;
                     defEngineSndNormal_->setPitch(clamp(pitch/MAX_VELOCITY_NORMAL + 1, 0.5f, 2.0f));
                 }
-                else if (this->steeringDirectionZ_ > 0 && velocity.z < 0)
+                else if (this->steeringDirectionZ_ > 0.0 && velocity.z < 0.0)
                     newState = Brake;
                 else
                     newState = Idle;

Modified: code/branches/presentation2/src/orxonox/items/MultiStateEngine.h
===================================================================
--- code/branches/presentation2/src/orxonox/items/MultiStateEngine.h	2009-12-12 18:08:51 UTC (rev 6328)
+++ code/branches/presentation2/src/orxonox/items/MultiStateEngine.h	2009-12-12 18:54:12 UTC (rev 6329)
@@ -70,7 +70,7 @@
             const std::string& getDefEngSndBoost();
 
         private:
-            int steeringDirectionZ_;
+            float steeringDirectionZ_;
             int state_;
             LuaState* lua_;
             std::vector<EffectContainer*> effectContainers_;




More information about the Orxonox-commit mailing list