Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4833 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Jul 11, 2005, 5:46:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fight against the mighty segfault

Location:
orxonox/trunk/src/world_entities/weapons
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.cc

    r4832 r4833  
    3232WeaponManager::WeaponManager(int nrOfSlots)
    3333{
    34   this->setClassID(CL_WEAPON_MANAGER, "WeaponManager");
    35 
    36   for(int i = 0; i < W_MAX_CONFIGS; ++i)
    37   {
    38     this->configs[i].bUsed = false;
    39     for(int j = 0; j < W_MAX_SLOTS; ++j)
    40       this->configs[i].slots[j] = NULL;
    41   }
     34  this->init();
    4235  this->nrOfSlots = nrOfSlots;
    43   this->currConfID = W_CONFIG0;
    44 }
    45 
    46 
     36}
     37
     38
     39/**
     40 * Destroys a WeaponManager
     41 */
    4742WeaponManager::~WeaponManager()
    4843{
     
    6055}
    6156
     57void WeaponManager::init()
     58{
     59  this->setClassID(CL_WEAPON_MANAGER, "WeaponManager");
     60
     61  for(int i = 0; i < W_MAX_CONFIGS; ++i)
     62  {
     63    this->configs[i].bUsed = false;
     64    for(int j = 0; j < W_MAX_SLOTS; ++j)
     65      this->configs[i].slots[j] = NULL;
     66  }
     67  this->currConfID = W_CONFIG0;
     68
     69}
    6270
    6371/**
     
    162170 * @param second passed since last tick
    163171 */
    164 void WeaponManager::tick(float sec)
     172void WeaponManager::tick(float dt)
    165173{
    166174  Weapon* w;
     
    168176  {
    169177    w = this->configs[this->currConfID].slots[i];
    170     if( w != NULL) w->tick(sec);
     178    if( w != NULL) w->tick(dt);
    171179  }
    172180}
     
    182190  {
    183191    w = this->configs[this->currConfID].slots[i];
    184     if( w != NULL) w->draw();
     192    if( w != NULL)
     193      w->draw();
    185194  }
    186195}
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.h

    r4832 r4833  
    5656
    5757//! this is a weapon Configuration: it has up to 8 slots
    58 typedef struct weaponConfig {
     58typedef struct weaponConfig
     59{
    5960  bool           bUsed;                       //!< is set to true, if this configuration is
    6061  Weapon*        slots[8];
     
    7677
    7778    void fire();
    78     void tick(float sec);
     79    void tick(float dt);
    7980    void draw();
    8081
Note: See TracChangeset for help on using the changeset viewer.