Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5296 in orxonox.OLD


Ignore:
Timestamp:
Oct 7, 2005, 10:42:22 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: modiefied PNode to match Element2D's removal methods.
see destructor header for more detail

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r5280 r5296  
    79877987
    79887988## SDL-check
    7989 #       SDL_CFLAGS=`sdl-config --cflags`
    7990 #       SDL_LIBS=`sdl-config --libs`
    7991 #       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
    7992 #       LIBS="$LIBS $SDL_LIBS"
     7989       SDL_CFLAGS=`sdl-config --cflags`
     7990       SDL_LIBS=`sdl-config --libs`
     7991       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
     7992       LIBS="$LIBS $SDL_LIBS"
    79937993
    79947994for ac_header in SDL/SDL.h
     
    81468146
    81478147   HAVE_SDL=yes
    8148    LIBS="$LIBS -framework SDL"
     8148#   LIBS="$LIBS -framework SDL"
    81498149
    81508150# checking for SDL-headers
  • trunk/src/lib/coord/p_node.cc

    r5255 r5296  
    7474
    7575/**
    76  *  standard deconstructor
    77 */
     76 * standard deconstructor
     77 *
     78 * There are two general ways to delete a PNode
     79 * 1. delete instance;
     80 *   -> result
     81 *    delete this Node and all its children and children's children...
     82 *    (danger if you still need the children's instance somewhere else!!)
     83 *
     84 * 2. instance->remove2D(); delete instance;
     85 *   -> result:
     86 *    moves its children to the NullParent
     87 *    then deletes the Element.
     88 */
    7889PNode::~PNode ()
    7990{
    80   if (this->parent)
    81     this->parent->removeChild(this);
    82   else
    83   {
    84    tIterator<PNode>* iterator = this->children->getIterator();
    85    PNode* pn = iterator->firstElement();
    86    while( pn != NULL)
    87      {
    88        delete pn;
    89        pn = iterator->nextElement();
    90      }
    91    delete iterator;
    92    /* this deletes all children in the list */
     91  // remove the Node, delete it's children.
     92  tIterator<PNode>* iterator = this->children->getIterator();
     93  PNode* child = iterator->firstElement();
     94
     95  while( child != NULL)
     96  {
     97    delete child;
     98    child = iterator->nextElement();
     99  }
     100  delete iterator;
     101
     102  if (this->parent != NULL)
     103  {
     104    this->parent->children->remove(this);
     105    this->parent = NULL;
    93106  }
    94107  delete this->children;
     108
     109  // remove all other allocated memory.
    95110  if (this->toCoordinate != NULL)
    96111    delete this->toCoordinate;
     
    98113    delete this->toDirection;
    99114}
     115
    100116
    101117/**
  • trunk/src/story_entities/world.cc

    r5294 r5296  
    128128
    129129
     130  // delete all the initialized Engines.
    130131  delete LightManager::getInstance();
    131132  delete TrackManager::getInstance();
    132133  delete ParticleEngine::getInstance();
    133   delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
     134  delete AnimationPlayer::getInstance();
    134135  delete PhysicsEngine::getInstance();
    135136
     
    142143  // erease everything that is left.
    143144  delete NullParent::getInstance();
    144   delete NullParent::getInstance();
    145145
    146146  // unload the resources !!
    147147  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
    148 
    149 
    150   EventHandler::getInstance()->debug();
    151   ClassList::debug(CL_PARENT_NODE, 3);
    152 //  exit(-1);
    153148
    154149  delete[] this->path;
Note: See TracChangeset for help on using the changeset viewer.