Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6078 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Dec 13, 2005, 2:55:08 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: PNode compiles again
PNode is now handled with the erase function of stl, rather than remove (which is totally the wrong way when iterating through a list and delete elements)

Location:
trunk/src/world_entities/weapons
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/aim.cc

    r6054 r6078  
    6565  this->setClassID(CL_CROSSHAIR, "Aim");
    6666  this->setName("Aim");
    67 
    68   this->addNodeModeFlags(PNODE_REPARENT_TO_NULLPARENT);
    6967
    7068  this->setLayer(E2D_LAYER_TOP);
  • trunk/src/world_entities/weapons/guided_missile.cc

    r6074 r6078  
    150150{
    151151  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    152   if (target.getParent() != PNode::getNullParent())
     152  if (this->target != NULL && this->target->getParent() != PNode::getNullParent())
    153153   {
    154      velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
     154     printf("========%s::%s\n", target->getParent()->getClassName(), target->getParent()->getName() );
     155     velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    155156     float speed = velocity.len();
    156157     if (speed > this->maxVelocity)
  • trunk/src/world_entities/weapons/projectile.cc

    r6074 r6078  
    3737  this->lifeCycle = 0.0;
    3838  this->lifeSpan = 1.0f; /* sec */
    39   this->target.addNodeModeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT |
    40                                 PNODE_REPARENT_TO_NULLPARENT);
    41 
     39  this->target = NULL;
    4240  this->removeNode();
    4341}
     
    103101void Projectile::setTarget(PNode* target)
    104102{
    105   this->target.setParent(target);
     103  if (this->target == NULL)
     104    this->target = new PNode(target, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE);
     105  else
     106    this->target->setParent(target);
    106107}
    107108
  • trunk/src/world_entities/weapons/projectile.h

    r6056 r6078  
    6060    Vector                velocity;                  //!< velocity of the projectile.
    6161
    62     PNode                 target;                    //!< A target for guided Weapons.
     62    PNode*                target;                    //!< A target for guided Weapons.
    6363};
    6464
Note: See TracChangeset for help on using the changeset viewer.