Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2005, 10:53:46 AM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Rolling toward bug-free-ness

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/lib/coord/p_node.cc

    r3499 r3557  
    4040  this->bAbsDirChanged = false;
    4141  this->parent = NULL;
     42  this->objectName = NULL;
    4243}
    4344
     
    5960  this->bAbsDirChanged = false;
    6061  this->parent = parent;
    61 
     62  this->objectName = NULL;
     63 
    6264  parent->addChild (this);
    6365}
     
    7981  */
    8082  this->parent = NULL;
     83  if( this->objectName) delete this->objectName;
    8184  /* there is currently a problem with cleaning up - fix*/
    8285}
     
    442445  \brief set the name of the node
    443446
     447        \todo Error free assignment of name by copying the string instead of keeping just the pointer
     448       
    444449  for debug purposes realy usefull, not used to work properly
    445450*/
    446 void PNode::setName (char* newName)
    447 {
    448   this->objectName = newName;
     451void PNode::setName (const char* newName)
     452{
     453        int l = strlen( newName);
     454       
     455        if( this->objectName != NULL) delete this->objectName;
     456        this->objectName = NULL;
     457       
     458        if( newName != NULL)
     459        {
     460                this->objectName = new char[l+1];
     461               
     462                for( int i = 0; i < l+1; i++)
     463                        this->objectName[i] = newName[i];
     464        }
    449465}
    450466
     
    453469  \brief gets the name of the node
    454470*/
    455 char* PNode::getName ()
     471const char* PNode::getName ()
    456472{
    457473  return this->objectName;
Note: See TracChangeset for help on using the changeset viewer.