Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7126 in orxonox.OLD


Ignore:
Timestamp:
Feb 13, 2006, 1:14:53 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: the delete Mechanism of PNode seems to work again.
This is done by always deleting the first node, and not walking through a list, that is eleminated during deletion time

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r7125 r7126  
    8080PNode::~PNode ()
    8181{
    82   printf("delete PNode: %s::%s\n", this->getClassName(), this->getName());
     82  PRINTF(4)("delete %s::%s\n", this->getClassName(), this->getName());
    8383  // remove the Node, delete it's children (if required).
    8484  std::list<PNode*>::iterator tmp = this->children.begin();
    8585  std::list<PNode*>::iterator deleteNode;
     86  unsigned int size;
    8687  while(!this->children.empty())
    87     while (tmp != this->children.end())
     88  {
     89    tmp = this->children.begin();
     90    //while (tmp != this->children.end())
    8891    {
    8992      deleteNode = tmp;
    9093      tmp++;
    91       //      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName());
     94      size = this->children.size();
    9295      if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) ||
    9396          ((*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
     
    9598        if (this == PNode::nullParent && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULL)
    9699        {
    97           printf("%s::%s deletes PNode: %s::%s\n",
     100          PRINTF(4)("%s::%s deletes %s::%s\n",
    98101                 this->getClassName(), this->getName(),
    99102                 (*deleteNode)->getClassName(), (*deleteNode)->getName());
     
    102105        else
    103106        {
    104           printf("%s::%s reparents PNode: %s::%s\n",
     107          PRINTF(4)("%s::%s reparents %s::%s\n",
    105108                 this->getClassName(), this->getName(),
    106109                 (*deleteNode)->getClassName(), (*deleteNode)->getName());
    107 
    108110          (*deleteNode)->reparent();
    109111        }
     
    111113      else
    112114      {
    113         printf("%s::%s deletes PNode: %s::%s\n",
     115        PRINTF(4)("%s::%s deletes PNode: %s::%s\n",
    114116               this->getClassName(), this->getName(),
    115117               (*deleteNode)->getClassName(), (*deleteNode)->getName());
    116118        delete (*deleteNode);
    117119      }
     120      //if (size <= this->children.size()) break;
    118121    }
     122  }
    119123
    120124  if (this->parent != NULL)
  • trunk/src/orxonox.cc

    r7123 r7126  
    120120
    121121  SDL_QuitSubSystem(SDL_INIT_TIMER);
    122   ClassList::debug(3);
     122  ClassList::debug();
    123123
    124124  PRINT(3)
  • trunk/src/story_entities/game_world_data.cc

    r7125 r7126  
    252252  FastFactory::flushAll(true);
    253253  GraphicsEngine::getInstance()->displayFPS(false);
    254   State::setPlayer(NULL);
    255254  // erease everything that is left.
    256255  // delete PNode::getNullParent(); // not needed as this is also done in the next step (and also much cleaner)
     
    261260    while (!nodeList->empty())
    262261  {
    263     ClassList::debug( 3, CL_PARENT_NODE);
    264     PNode::getNullParent()->debugNode( 1);
    265 
    266 /*    printf("%s::%s\n", nodeList->front()->getClassName(), nodeList->front()->getName());*/
     262//    ClassList::debug( 3, CL_PARENT_NODE);
     263//    PNode::getNullParent()->debugNode(0);
     264//    printf("%s::%s\n", nodeList->front()->getClassName(), nodeList->front()->getName());
    267265    delete nodeList->front();
    268     printf("OK\n");
    269266  }
    270267  /* remove the player object */
    271268  if( this->localPlayer)
    272269    delete this->localPlayer;
     270  State::setPlayer(NULL);
    273271
    274272  nodeList = ClassList::getList(CL_GRAPHICS_EFFECT);
  • trunk/src/world_entities/environments/water.cc

    r7125 r7126  
    6363Water::~Water()
    6464{
    65   delete this->grid;
    6665}
    6766
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r7125 r7126  
    8080  Weapon* wpLeft = new TestGun(1);
    8181  wpLeft->setName("testGun Left");
    82   Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
    83 
    84   cannon->setName("BFG");
     82  //Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
     83
     84  //  cannon->setName("BFG");
    8585
    8686  this->addWeapon(wpLeft, 1, 0);
    8787  this->addWeapon(wpRight,1 ,1);
    88   this->addWeapon(cannon, 0, 2);
     88  //this->addWeapon(cannon, 0, 2);
    8989
    9090  this->getWeaponManager()->changeWeaponConfig(1);
  • trunk/src/world_entities/weapons/weapon.cc

    r7102 r7126  
    2929#include "state.h"
    3030#include "animation3d.h"
    31 #include "vector.h"
    3231
    3332#include "sound_source.h"
     
    8685  this->soundSource = new SoundSource(this);       //< Every Weapon has exacty one SoundSource.
    8786  this->emissionPoint.setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
     87  this->emissionPoint.setName("EmissionPoint");
     88  this->emissionPoint.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    8889
    8990  this->defaultTarget = NULL;                      //< Nothing is Targeted by default.
Note: See TracChangeset for help on using the changeset viewer.