Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2008, 2:34:54 AM (16 years ago)
Author:
landauf
Message:

used isInitialized() in destructors where needed and changed constructors back to normal variable initialization instead of the "myclass() : variable(value), …" pattern. in my opinion this is much more comfortable and I hope everyone agrees ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/WorldEntity.cc

    r1558 r1559  
    4545    unsigned int WorldEntity::worldEntityCounter_s = 0;
    4646
    47     WorldEntity::WorldEntity() :
    48       velocity_    (0, 0, 0),
    49       acceleration_(0, 0, 0),
    50       rotationAxis_(0, 1, 0),
    51       rotationRate_(0),
    52       momentum_    (0),
    53       node_        (0),
    54       bStatic_     (true)
     47    WorldEntity::WorldEntity()
    5548    {
    5649        RegisterObject(WorldEntity);
     
    5851        if (GraphicsEngine::getSingleton().getSceneManager())
    5952        {
    60           std::ostringstream name;
    61           name << (WorldEntity::worldEntityCounter_s++);
    62           this->setName("WorldEntity" + name.str());
    63           this->node_ = GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
     53            std::ostringstream name;
     54            name << (WorldEntity::worldEntityCounter_s++);
     55            this->setName("WorldEntity" + name.str());
     56            this->node_ = GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
    6457
    65           registerAllVariables();
     58            registerAllVariables();
    6659        }
     60        else
     61        {
     62            this->node_ = 0;
     63        }
     64
     65        this->bStatic_ = true;
     66        this->velocity_ = Vector3(0, 0, 0);
     67        this->acceleration_ = Vector3(0, 0, 0);
     68        this->rotationAxis_ = Vector3(0, 1, 0);
     69        this->rotationRate_ = 0;
     70        this->momentum_ = 0;
    6771    }
    6872
     
    7074    WorldEntity::~WorldEntity()
    7175    {
    72         // just to make sure we clean out all scene nodes
    73         if(this->getNode())
     76        if (this->isInitialized())
    7477        {
    7578            this->getNode()->removeAndDestroyAllChildren();
Note: See TracChangeset for help on using the changeset viewer.