- Timestamp:
- Apr 18, 2009, 6:14:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2915 r2918 64 64 XMLPortParam(WeaponSet, "firemode", setDesiredFiremode, getDesiredFiremode, xmlelement, mode); 65 65 } 66 /*67 void WeaponSet::attachWeaponPack(WeaponPack *wPack)68 {69 if ( this->weaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->weaponSystem_->getWeaponSlotSize() ) )70 {71 this->attachedWeaponPack_ = wPack;72 int wPackWeapon = 0; //WeaponCounter for Attaching73 74 //should be possible to choose which slot to use75 //attach every weapon of the weaponPack to a weaponSlot76 for ( int i=0; i < wPack->getSize() ; i++ )77 {78 //at the moment this function only works for one weaponPack in the entire WeaponSystem...79 //it also takes the first free weaponSlot...80 if ( this->weaponSystem_->getWeaponSlot(i)->getAttachedWeapon() == 0 && this->weaponSystem_->getWeaponSlot(i) != 0) //if slot not full81 {82 this->setWeaponSlots_.push_back( this->weaponSystem_->getWeaponSlot(i) );83 this->weaponSystem_->getWeaponSlot(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );84 this->weaponSystem_->getPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );85 wPackWeapon++;86 }87 else88 {89 for (int k=0; k < this->weaponSystem_->getWeaponSlotSize(); k++)90 {91 if ( this->weaponSystem_->getWeaponSlot(k)->getAttachedWeapon() == 0 )92 {93 this->setWeaponSlots_.push_back( this->weaponSystem_->getWeaponSlot(k) );94 this->weaponSystem_->getWeaponSlot(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );95 this->weaponSystem_->getPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );96 wPackWeapon++;97 }98 }99 }100 }101 }102 }103 */104 66 105 67 void WeaponSet::fire() … … 109 71 if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 110 72 it->first->fire(it->second); 73 } 74 75 void WeaponSet::reload() 76 { 77 // fire all WeaponPacks with their defined weaponmode 78 for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it) 79 it->first->reload(); 111 80 } 112 81
Note: See TracChangeset
for help on using the changeset viewer.