Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3552 in orxonox.OLD for orxonox/trunk/src/lib/coord


Ignore:
Timestamp:
Mar 14, 2005, 11:58:59 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: added init-function to PNode and chars now get copied and deleted instead of just the reference

Location:
orxonox/trunk/src/lib/coord
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/null_parent.h

    r3551 r3552  
    1818  virtual ~NullParent ();
    1919
    20   static NullParent* singletonRef;
    2120
    2221  virtual void update ();
     
    2524  NullParent ();
    2625  NullParent (Vector* absCoordinate);
     26  static NullParent* singletonRef;
    2727
    2828};
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3551 r3552  
    3434PNode::PNode ()
    3535{
    36   this->children = new tList<PNode>();
    37   this->bRelCoorChanged = true;
    38   this->bAbsCoorChanged = false;
    39   this->bRelDirChanged = true;
    40   this->bAbsDirChanged = false;
    41   this->parent = NULL;
    42   this->objectName = NULL;
     36  init(NULL);
    4337
    4438  NullParent* np = NullParent::getInstance();
     
    5751  this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
    5852 
    59   this->children = new tList<PNode>();
    60   this->bRelCoorChanged = true;
    61   this->bAbsCoorChanged = false;
    62   this->bRelDirChanged = true;
    63   this->bAbsDirChanged = false;
    64   this->parent = parent;
    65   this->objectName = NULL;
     53  this->init(parent);
    6654
    6755  parent->addChild (this);
     
    8472PNode::PNode(char* name)
    8573{
    86   this->children = new tList<PNode>();
    87   this->bRelCoorChanged = true;
    88   this->bAbsCoorChanged = false;
    89   this->bRelDirChanged = true;
    90   this->bAbsDirChanged = false;
    91   this->parent = NULL;
    92   this->objectName = NULL;
     74  this->init(NULL);
    9375}
    9476
     
    121103  delete this->children;
    122104
    123 }
    124 
     105  delete []this->objectName;
     106}
     107
     108void PNode::init(PNode* parent)
     109{
     110  this->children = new tList<PNode>();
     111  this->bRelCoorChanged = true;
     112  this->bAbsCoorChanged = false;
     113  this->bRelDirChanged = true;
     114  this->bAbsDirChanged = false;
     115  this->parent = parent;
     116  this->objectName = NULL;
     117}
    125118
    126119/**
     
    540533void PNode::setName (char* newName)
    541534{
    542   this->objectName = newName;
     535  this->objectName = new char[strlen(newName)+1];
     536  strcpy(this->objectName,newName);
    543537}
    544538
  • orxonox/trunk/src/lib/coord/p_node.h

    r3551 r3552  
    8383  void debug ();
    8484
     85 private:
     86  void init(PNode* parent);
     87
    8588 protected:
    8689  PNode(char*);
Note: See TracChangeset for help on using the changeset viewer.