Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3620 in orxonox.OLD for orxonox/trunk/src/world_entities/player.cc


Ignore:
Timestamp:
Mar 21, 2005, 5:37:58 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: added worldinterface, to enable all worldentities to access the entities list. so they can add entities themselfes. this is a nice hack

File:
1 edited

Legend:

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

    r3618 r3620  
    2020#include "player.h"
    2121
     22#include "track_manager.h"
     23#include "objModel.h"
     24#include "weapon.h"
     25#include "test_gun.h"
     26#include "world.h"
     27
     28#include "list.h"
    2229#include "stdincl.h"
    23 //#include "collision.h"
    24 #include "objModel.h"
    25 #include "list.h"
    26 #include "weapon.h"
    27 #include "track_manager.h"
    2830
    2931using namespace std;
     
    3335   \param isFree if the player is free
    3436*/
    35 Player::Player(bool isFree) : WorldEntity(isFree)
    36 {
    37   this->model = new OBJModel("../data/models/reaplow.obj");
     37Player::Player() : WorldEntity()
     38{
    3839  this->weapons = new tList<Weapon>();
    3940  this->activeWeapon = NULL;
    40 
     41  /*
     42    this is the debug player - actualy we would have to make a new
     43     class derivated from Player for each player. for now, we just use
     44     the player.cc for debug also
     45  */
     46  this->model = new OBJModel("../data/models/reaplow.obj");
    4147  travelSpeed = 15.0;
    4248  velocity = new Vector();
     
    4450  bFire = false;
    4551  acceleration = 10.0;
     52  //weapons:
     53  Weapon* wp = new TestGun();
     54  this->weapons->add(wp);
     55  this->activeWeapon = wp; 
    4656}
    4757
     
    5161Player::~Player ()
    5262{
    53   Weapon* w = this->weapons->enumerate();
    54   while( w != NULL)
    55     {
    56       delete w;
    57       w = this->weapons->nextElement();
    58     }
     63  /* do not delete the weapons, they are contained in the pnode tree
     64     and will be deleted there.
     65     this only frees the memory allocated to save the list.
     66  */
    5967  delete this->weapons;
    60  
    61   //delete this->velocity;
    6268}
    6369
     
    150156{
    151157  // player controlled movement
    152   this->move (time);
     158  this->move(time);
    153159  // weapon system manipulation
    154   this->fire();
     160  this->weapon();
    155161}
    156162
     
    190196   \brief weapon manipulation by the player
    191197*/
    192 void Player::fire()
     198void Player::weapon()
    193199{
    194200  if( this->bFire)
Note: See TracChangeset for help on using the changeset viewer.