Changeset 2098 for code/trunk/src/orxonox/objects/WeaponSystem.cc
- Timestamp:
- Nov 1, 2008, 11:17:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/WeaponSystem.cc
r2097 r2098 48 48 { 49 49 RegisterObject(WeaponSystem); 50 51 this->activeWeaponSet_ = 0; 52 this->parentSpaceShip_ = 0; 50 53 } 51 54 … … 62 65 63 66 //the first weaponSet is at n=0 64 void WeaponSystem::setActiveWeaponSet( int n)67 void WeaponSystem::setActiveWeaponSet(unsigned int n) 65 68 { 66 if ( (int) weaponSets_.size() <= n ) 67 n=0; 68 this->activeWeaponSet_ = this->weaponSets_[n]; 69 if (n < this->weaponSets_.size()) 70 this->activeWeaponSet_ = this->weaponSets_[n]; 69 71 } 70 72 71 73 //n is the n'th weaponSet, starting with zero 72 74 //Spaceship.cc only needs to have the keybinding to a specific Set-number n 73 void WeaponSystem::fire( int n)75 void WeaponSystem::fire(unsigned int n) 74 76 { 75 if (n >=0)77 if (n < this->weaponSets_.size()) 76 78 this->weaponSets_[n]->fire(); 77 79 } 78 80 79 WeaponSet * WeaponSystem::getWeaponSetPointer(int n)81 void WeaponSystem::fire() 80 82 { 81 return this->weaponSets_[n]; 83 if (this->activeWeaponSet_) 84 this->activeWeaponSet_->fire(); 85 } 86 87 WeaponSet * WeaponSystem::getWeaponSetPointer(unsigned int n) 88 { 89 if (n < this->weaponSets_.size()) 90 return this->weaponSets_[n]; 91 else 92 return 0; 82 93 } 83 94
Note: See TracChangeset
for help on using the changeset viewer.