Changeset 11166 for code/branches/sagerjFS16/src/orxonox/weaponsystem
- Timestamp:
- Apr 14, 2016, 4:02:00 PM (9 years ago)
- Location:
- code/branches/sagerjFS16/src/orxonox/weaponsystem
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc
r11164 r11166 114 114 // Note: The reloading of each WeaponMode is internally handled by each A, B and C. 115 115 // The reloading of the weapon is only performed to avoid firing with different modes at the same time. 116 orxout() << "fire weapon " << mode << endl; 116 117 if (this->bReloading_ && this->reloadingWeaponmode_ != mode) 117 118 return; … … 135 136 136 137 void Weapon::release(unsigned int mode) 137 {orxout() << "release weapon " << mode << endl;} 138 { 139 orxout() << "release weapon " << mode << endl; 140 if (this->bReloading_ && this->reloadingWeaponmode_ != mode) 141 return; 142 143 std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode); 144 std::multimap<unsigned int, WeaponMode*>::iterator end = this->weaponmodes_.upper_bound(mode); 145 146 for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it) 147 { 148 float reloading_time = 0; 149 if (it->second->release(&reloading_time)) 150 { 151 this->bReloading_ = true; 152 this->reloadingWeaponmode_ = mode; 153 154 this->reloadTimer_.setInterval(reloading_time); 155 this->reloadTimer_.startTimer(); 156 } 157 } 158 } 138 159 139 160 /** -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11164 r11166 121 121 { 122 122 (*reloadTime) = this->reloadTime_; 123 123 orxout() << "fire wm " << reloadTime << endl; 124 124 // Fireing is only possible if this weapon mode is not reloading and there is enough munition 125 125 if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this)) … … 169 169 } 170 170 171 void WeaponMode::release(float* reloadTime) 172 {orxout() << "release wmode " << reloadTime << endl;} 171 bool WeaponMode::release(float* reloadTime) 172 { 173 orxout() << "release wm " << reloadTime << endl; 174 return false; 175 } 173 176 174 177 bool WeaponMode::reload() -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
r11164 r11166 58 58 59 59 virtual bool fire(float* reloadTime); 60 virtual voidrelease(float* reloadTime);60 virtual bool release(float* reloadTime); 61 61 bool reload(); 62 62 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc
r11164 r11166 76 76 void WeaponPack::fire(unsigned int weaponmode) 77 77 { 78 orxout() << "fire wp " << weaponmode << endl; 78 79 for (Weapon* weapon : this->weapons_) 79 80 weapon->fire(weaponmode); … … 82 83 void WeaponPack::release(unsigned int weaponmode) 83 84 { 85 orxout() << "release wp " << weaponmode << endl; 84 86 for (Weapon* weapon : this->weapons_) 85 87 weapon->release(weaponmode); 86 orxout() << "release wpack " << weaponmode << endl;87 88 } 88 89 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc
r11164 r11166 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 orxout() << "fire wset " << endl; 65 66 for (const auto& mapEntry : this->weaponpacks_) 66 67 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) … … 70 71 void WeaponSet::release() 71 72 { 72 73 73 // Fire all WeaponPacks with their defined weaponmode 74 orxout() << "release wset " << endl; 74 75 for (const auto& mapEntry : this->weaponpacks_) 75 76 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 76 77 mapEntry.first->release(mapEntry.second); 77 orxout() << "release wset " << endl;78 79 78 } 80 79 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc
r11164 r11166 289 289 void WeaponSystem::fire(unsigned int firemode) 290 290 { 291 orxout() << "fire wsys " << firemode << endl; 291 292 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 292 293 if (it != this->weaponSets_.end() && it->second) … … 296 297 void WeaponSystem::release(unsigned int firemode) 297 298 { 299 orxout() << "release wsys " << firemode << endl; 298 300 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 299 301 if (it != this->weaponSets_.end() && it->second) 300 302 it->second->release(); 301 orxout() << "release wsys " << firemode << endl;302 303 } 303 304
Note: See TracChangeset
for help on using the changeset viewer.