Changeset 6669 in orxonox.OLD for trunk/src/world_entities/weapons/weapon_manager.cc
- Timestamp:
- Jan 24, 2006, 2:26:15 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/weapon_manager.cc
r6568 r6669 203 203 } 204 204 205 206 bool WeaponManager::addWeapon(Weapon* weapon) 207 { 208 int weaponConf = this->currentConfigID; 209 int slot; 210 if (slot = this->getNextFreeSlot(weaponConf, weapon->getCapability()) == -1 ) 211 this->addWeapon(weapon, weaponConf, slot); 212 } 205 213 206 214 /** … … 246 254 //! @todo check if the weapon is already assigned to another config in another slot 247 255 this->configs[configID][slotID] = weapon; 256 weapon->setAmmoContainer(this->getAmmoContainer(weapon->getProjectileType())); 248 257 if (this->parent != NULL) 249 258 { … … 420 429 /** 421 430 * private gets the next free slot in a certain weaponconfig 422 * @param the selected weaponconfig 431 * @param the selected weaponconfig -1 if none found 423 432 */ 424 433 int WeaponManager::getNextFreeSlot(int configID, long capability) … … 434 443 } 435 444 445 CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(ClassID projectileType) 446 { 447 for (unsigned int i = 0; i < this->ammo.size(); i++) 448 { 449 if (this->ammo[i]->getProjectileType() == projectileType) 450 return this->ammo[i]; 451 } 452 this->ammo.push_back(CountPointer<AmmoContainer>(new AmmoContainer(projectileType))); 453 return this->ammo.back(); 454 } 436 455 437 456
Note: See TracChangeset
for help on using the changeset viewer.