Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3888 in orxonox.OLD


Ignore:
Timestamp:
Apr 19, 2005, 1:16:16 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: deconstructor cleanup in weapon/gun

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

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3886 r3888  
    4747  this->leftRight = leftRight;
    4848
    49   if( this->leftRight == 0)
    50     this->projOffset = new Vector(1.0, 0.0, -0.35);
    51   else if( this->leftRight == 1)
    52     this->projOffset = new Vector(1.0, 0.0, 0.5);
    53 
    54 
    55   //this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon
    5649  this->objectComponent1 = new PNode();
    5750  this->animation1 = new Animation3D(this->objectComponent1);
    58 
    5951  parent->addChild(this->objectComponent1, PNODE_ALL);
    6052
     
    6355  if( this->leftRight == W_LEFT)
    6456    {
     57      this->projectileOffset = Vector(1.0, 0.0, -0.35);
     58
    6559      this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    6660      this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
     
    6963  else if( this->leftRight == W_RIGHT)
    7064    {
     65      this->projectileOffset = Vector(1.0, 0.0, 0.5);
     66
    7167      this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
    7268      this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
     
    119115      return;
    120116    }
     117
    121118  Projectile* pj = new TestBullet(this);
    122 
    123   pj->setAbsCoor(this->getAbsCoor() + *this->projOffset);
     119  pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
    124120  pj->setAbsDir(this->getAbsDir());
    125 
    126121  pj->setFlightDirection(this->getAbsDir());
    127122  pj->setSpeed(this->getSpeed());
    128 
    129123  this->worldEntities->add(pj);
    130124  this->localTime = 0;
  • orxonox/trunk/src/world_entities/test_gun.h

    r3886 r3888  
    5151  virtual void draw(void);
    5252
    53  private:
    54   Animation3D* animation;
    55   Vector* projOffset;
    56   int leftRight;   // this will become an enum
     53
     54
    5755
    5856};
  • orxonox/trunk/src/world_entities/weapon.cc

    r3881 r3888  
    5252  /*
    5353     i dont have to delete the weapons itself, because they are
    54      worldentities and therefore in the entities list of the world
     54     worldentities and therefore in the entities list of the world.
     55     world will clean them up for me
    5556  */
    5657  for(int i = 0; i < W_MAX_CONFIGS; ++i)
     
    207208  WorldInterface* wi = WorldInterface::getInstance();
    208209  this->worldEntities = wi->getEntityList();
     210
     211  this->objectComponent1 = NULL;
     212  this->objectComponent2 = NULL;
     213  this->objectComponent3 = NULL;
     214
     215  this->animation1 = NULL;
     216  this->animation2 = NULL;
     217  this->animation3 = NULL;
    209218}
    210219
     
    216225{
    217226  // model will be deleted from WorldEntity-destructor
     227  //this->worldEntities = NULL;
     228 
     229  /* dont delete objectComponentsX here, they will be killed when the pnodes are cleaned out */
     230
     231  /* all animations are deleted via the animation player*/
    218232}
    219233
  • orxonox/trunk/src/world_entities/weapon.h

    r3886 r3888  
    172172  Animation3D* animation3;
    173173
    174   Vector* projectileOffset;
     174  Vector projectileOffset;
    175175  int leftRight;   // this will become an enum
    176176
Note: See TracChangeset for help on using the changeset viewer.