[Orxonox-commit 3103] r7797 - code/branches/presentation2/src/modules/objects

scheusso at orxonox.net scheusso at orxonox.net
Wed Dec 22 11:08:54 CET 2010


Author: scheusso
Date: 2010-12-22 11:08:53 +0100 (Wed, 22 Dec 2010)
New Revision: 7797

Modified:
   code/branches/presentation2/src/modules/objects/ForceField.cc
   code/branches/presentation2/src/modules/objects/ForceField.h
Log:
trying to make forcefield synchronisable


Modified: code/branches/presentation2/src/modules/objects/ForceField.cc
===================================================================
--- code/branches/presentation2/src/modules/objects/ForceField.cc	2010-12-22 09:37:18 UTC (rev 7796)
+++ code/branches/presentation2/src/modules/objects/ForceField.cc	2010-12-22 10:08:53 UTC (rev 7797)
@@ -59,6 +59,8 @@
         this->setDiameter(500);
         this->setLength(2000);
         this->mode_ = forceFieldMode::tube;
+        
+        this->registerVariables();
     }
 
     /**
@@ -82,7 +84,16 @@
         XMLPortParam(ForceField, "length", setLength  , getLength  , xmlelement, mode).defaultValues(2000);
         XMLPortParam(ForceField, "mode", setMode, getMode, xmlelement, mode);
     }
+    
+    void ForceField::registerVariables()
+    {
+        registerVariable(this->velocity_, VariableDirection::ToClient);
+        registerVariable(this->radius_, VariableDirection::ToClient);
+        registerVariable(this->halfLength_, VariableDirection::ToClient);
+        registerVariable(this->mode_, VariableDirection::ToClient);
+    }
 
+
     /**
     @brief
         A method that is called every tick.

Modified: code/branches/presentation2/src/modules/objects/ForceField.h
===================================================================
--- code/branches/presentation2/src/modules/objects/ForceField.h	2010-12-22 09:37:18 UTC (rev 7796)
+++ code/branches/presentation2/src/modules/objects/ForceField.h	2010-12-22 10:08:53 UTC (rev 7797)
@@ -87,7 +87,9 @@
             virtual ~ForceField();
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a ForceField object through XML.
+            void registerVariables(); //!< Registers the variables that should get synchronised over the network
             virtual void tick(float dt); //!< A method that is called every tick.
+            
 
             /**
             @brief Set the velocity of the ForceField.




More information about the Orxonox-commit mailing list