- Timestamp:
- Nov 19, 2008, 7:07:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Munition.cc
r2203 r2232 46 46 } 47 47 48 unsigned int Munition::getBullets() 49 { return this->bullets_; } 48 50 49 void Munition::decrementBullets() 51 unsigned int Munition::getMagazines() 52 { return this->magazines_; } 53 54 void Munition::setMaxBullets(unsigned int amount) 55 { this->maxBullets_ = amount; } 56 57 void Munition::setMaxMagazines(unsigned int amount) 58 { this->maxMagazines_ = amount; } 59 60 void Munition::removeBullets(unsigned int amount, Weapon * parentWeapon) 50 61 { 51 this->bullets--; 62 //if actual magazine is empty, decrement it and set the bullets amount to full (masBullets_) 63 if ( this->bullets_ == 0 ) 64 { 65 this->removeMagazines(1); 66 parentWeapon->magazineTimer(); 67 this->bullets_ = this->maxBullets_; 68 } 69 else 70 this->bullets_ = this->bullets_ - amount; 52 71 } 53 void Munition::decrementMagazines() 72 73 void Munition::removeMagazines(unsigned int amount) 54 74 { 55 this->magazines--; 75 if ( this->magazines_ == 0 ) 76 { 77 if ( this->bullets_ == 0 ) 78 { 79 //no bullets and no magazines 80 } 81 else 82 { 83 //what to do when there are no more magazines? 84 } 85 } 86 else 87 this->magazines_ = this->magazines_ - amount; } 88 89 void Munition::addBullets(unsigned int amount) 90 { 91 if ( this->bullets_ == this->maxBullets_ ) 92 { 93 //cannot add bullets to actual magazine 94 } 95 else 96 this->bullets_ = this->bullets_ + amount; 56 97 } 57 void Munition::incrementBullets() 98 99 void Munition::addMagazines(unsigned int amount) 58 100 { 59 this->bullets++; 60 } 61 void Munition::incrementMagazines() 62 { 63 this->magazines++; 101 if ( this->magazines_ == this->maxMagazines_ ) 102 { 103 //no more capacity for another magazine 104 } 105 else 106 this->magazines_ = this->magazines_ + amount; 64 107 } 65 108
Note: See TracChangeset
for help on using the changeset viewer.