[Orxonox-commit 5549] r10212 - in code/branches/presentationFS14/src/orxonox/worldentities: . pawns

landauf at orxonox.net landauf at orxonox.net
Sat Jan 31 16:14:57 CET 2015


Author: landauf
Date: 2015-01-31 16:14:57 +0100 (Sat, 31 Jan 2015)
New Revision: 10212

Modified:
   code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h
   code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
   code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h
Log:
removed detach() from ModularSpaceShip which was just copy-pasted from its base class WorldEntity.
removed another unused function from WorldEntity.

Modified: code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h	2015-01-31 14:51:08 UTC (rev 10211)
+++ code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h	2015-01-31 15:14:57 UTC (rev 10212)
@@ -71,7 +71,6 @@
     class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState
     {
         friend class Scene;
-        friend class ModularSpaceShip;
 
         public:
             // Define our own transform space enum to avoid Ogre includes here
@@ -207,9 +206,6 @@
 
             void notifyChildPropsChanged();
 
-            inline int getNumAttachedObj()
-                { return this->children_.size(); }
-
         protected:
             virtual void parentChanged() {}
 

Modified: code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2015-01-31 14:51:08 UTC (rev 10211)
+++ code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2015-01-31 15:14:57 UTC (rev 10212)
@@ -41,7 +41,6 @@
 #include "items/ShipPart.h"
 #include "items/Engine.h"
 #include "worldentities/StaticEntity.h"
-#include "collisionshapes/WorldEntityCollisionShape.h"
 #include <BulletCollision/CollisionShapes/btCollisionShape.h>
 #include <BulletCollision/CollisionShapes/btCompoundShape.h>
 
@@ -91,7 +90,7 @@
     void ModularSpaceShip::updatePartAssignment()
     {
         // iterate through all attached objects
-        for (unsigned int i=0; i < (unsigned int)(this->getNumAttachedObj()); i++)
+        for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
         {
             if (this->getAttachedObject(i) == NULL)
             {
@@ -312,36 +311,4 @@
             }
         }
     }
-
-    /**
-    @brief
-        Detaches a child WorldEntity from this instance.
-    */
-    void ModularSpaceShip::detach(WorldEntity* object)
-    {
-        std::set<WorldEntity*>::iterator it = this->children_.find(object);
-        if (it == this->children_.end())
-        {
-            orxout(internal_warning) << "Cannot detach an object that is not a child." << endl;
-            return;
-        }
-
-        // collision shapes
-
-        //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);
-        this->detachCollisionShape(object->collisionShape_);  // after succeeding, causes a crash in the collision handling
-        //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);
-
-        // mass
-        if (object->getMass() > 0.0f)
-        {
-            this->childrenMass_ -= object->getMass();
-            recalculateMassProps();
-        }
-
-        this->detachNode(object->node_);
-        this->children_.erase(it);        // this causes a crash when unloading the level. Or not?
-
-        object->notifyDetached();
-    }
 }

Modified: code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h	2015-01-31 14:51:08 UTC (rev 10211)
+++ code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h	2015-01-31 15:14:57 UTC (rev 10212)
@@ -126,8 +126,6 @@
             inline float getRotationThrust()
                 { return this->rotationThrust_; }
 
-            void detach(WorldEntity* object);
-
             virtual void updatePartAssignment();
 
         protected:




More information about the Orxonox-commit mailing list