- Timestamp:
- Dec 10, 2008, 5:30:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Munition.cc
r2379 r2391 46 46 } 47 47 48 boolMunition::bullets()48 unsigned int Munition::bullets() 49 49 { 50 50 if (this->bullets_ > 0) 51 return true;51 return bullets_; 52 52 else 53 return false;53 return 0; 54 54 } 55 55 56 boolMunition::magazines()56 unsigned int Munition::magazines() 57 57 { 58 58 if (this->magazines_ > 0) 59 return true;59 return magazines_; 60 60 else 61 return false;61 return 0; 62 62 } 63 63 … … 68 68 { this->maxMagazines_ = amount; } 69 69 70 void Munition::removeBullets(unsigned int amount , Weapon * parentWeapon)70 void Munition::removeBullets(unsigned int amount) 71 71 { 72 if ( this->bullets_ == 0 ) 73 { 74 this->removeMagazines(1); 75 parentWeapon->magazineTimer(0); 76 this->bullets_ = this->maxBullets_; 77 } 78 else 72 if ( this->bullets_ != 0 ) 79 73 this->bullets_ = this->bullets_ - amount; 80 74 } … … 82 76 void Munition::removeMagazines(unsigned int amount) 83 77 { 84 if ( this->magazines_ == 0 ) 85 { 86 if ( this->bullets_ == 0 ) 87 { 88 //no bullets and no magazines 89 } 90 else 91 { 92 //what to do when there are no more magazines? 93 } 94 } 95 else 78 if ( this->magazines_ != 0 ) 96 79 this->magazines_ = this->magazines_ - amount; 97 80 } … … 120 103 void Munition::fillBullets() 121 104 { 105 COUT(0) << "Munition::fillBullets maxBullets_=" << this->maxBullets_ << std::endl; 122 106 this->bullets_ = this->maxBullets_; 123 107 } … … 130 114 void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode) 131 115 { 132 116 SUPER(Munition, XMLPort, xmlelement, mode); 133 117 } 134 118
Note: See TracChangeset
for help on using the changeset viewer.