Changeset 2327
- Timestamp:
- Dec 3, 2008, 4:30:13 PM (16 years ago)
- Location:
- code/branches/weapon2/src/orxonox/objects
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc
r2288 r2327 37 37 namespace orxonox 38 38 { 39 CreateFactory(Weapon); 40 39 41 Weapon::Weapon(BaseObject* creator) : BaseObject(creator) 40 42 { … … 42 44 this->bulletReadyToShoot_ = true; 43 45 this->magazineReadyToShoot_ = true; 44 this->setParentWeaponSystem();45 46 } 46 47 … … 95 96 * 96 97 */ 97 void Weapon::setParentWeaponSystem()98 { this->parentWeaponSystem_ = this->parentWeaponSlot_->getParentWeaponSystem(); }99 100 98 Munition * Weapon::getAttachedMunition() 101 99 { return this->munition_; } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h
r2272 r2327 52 52 virtual void fire(); 53 53 void attachNeededMunition(std::string munitionType); 54 virtual void setParentWeaponSystem();55 54 Munition * getAttachedMunition(); 56 55 … … 72 71 73 72 inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot) 74 { parentWeaponSlot_=parentWeaponSlot; };73 { this->parentWeaponSlot_=parentWeaponSlot; }; 75 74 inline WeaponSlot * getParentWeaponSlot() 76 { return parentWeaponSlot_; }; 75 { return this->parentWeaponSlot_; }; 76 inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem) 77 { this->parentWeaponSystem_=parentWeaponSystem; }; 78 inline WeaponSystem * getParentWeaponSystem() 79 { return this->parentWeaponSystem_; }; 77 80 78 81 private: -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.cc
r2319 r2327 39 39 namespace orxonox 40 40 { 41 CreateFactory(WeaponPack); 42 41 43 WeaponPack::WeaponPack(BaseObject* creator) : BaseObject(creator) 42 44 { … … 66 68 for (int i=0; i < (int) this->weapons_.size(); i++) 67 69 { 68 COUT(0) << "WeaponPack::fire "<< i << std::endl;70 COUT(0) << "WeaponPack::fire (attached from WeaponSet)"<< i << std::endl; 69 71 this->weapons_[i]->fire(); 70 72 } … … 94 96 void WeaponPack::addWeapon(Weapon * weapon) 95 97 { 98 weapon->setParentWeaponSystem(this->parentWeaponSystem_); 96 99 this->weapons_.push_back(weapon); 97 100 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc
r2319 r2327 39 39 namespace orxonox 40 40 { 41 CreateFactory(WeaponSet); 42 41 43 WeaponSet::WeaponSet(BaseObject* creator, int k) : BaseObject(creator) 42 44 { … … 53 55 void WeaponSet::attachWeaponPack(WeaponPack *wPack) 54 56 { 57 COUT(0) << "WeaponSet::attachWeaponPack" << std::endl; 55 58 if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) ) 56 59 { … … 75 78 { 76 79 //fires all WeaponSlots available for this weaponSet attached from the WeaponPack 80 COUT(0) << "WeaponSet::fire" << std::endl; 77 81 this->attachedWeaponPack_->fire(); 78 82 } -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.cc
r2319 r2327 38 38 namespace orxonox 39 39 { 40 CreateFactory(WeaponSlot); 41 40 42 WeaponSlot::WeaponSlot(BaseObject* creator) : PositionableEntity(creator) 41 43 { -
code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc
r2319 r2327 46 46 namespace orxonox 47 47 { 48 CreateFactory(WeaponSystem); 48 49 49 50 WeaponSystem::WeaponSystem(BaseObject* creator) : BaseObject(creator) … … 61 62 void WeaponSystem::attachWeaponPack(WeaponPack *wPack, unsigned int firemode) 62 63 { 64 wPack->setParentWeaponSystem(this); 63 65 this->weaponSets_[firemode]->attachWeaponPack(wPack); 64 66 this->weaponPacks_[firemode] = wPack; 65 wPack->setParentWeaponSystem(this);66 67 } 67 68 68 69 void WeaponSystem::attachWeaponSlot(WeaponSlot *wSlot) 69 70 { 71 wSlot->setParentWeaponSystem(this); 70 72 this->weaponSlots_.push_back(wSlot); 71 wSlot->setParentWeaponSystem(this);72 73 } 73 74 74 75 void WeaponSystem::attachWeaponSet(WeaponSet *wSet) 75 76 { 77 wSet->setParentWeaponSystem(this); 76 78 this->weaponSets_.push_back(wSet); 77 wSet->setParentWeaponSystem(this);78 79 } 79 80 -
code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc
r2288 r2327 39 39 namespace orxonox 40 40 { 41 CreateFactory(LaserGun); 42 41 43 LaserGun::LaserGun(BaseObject* creator) : Weapon(creator) 42 44 { -
code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2319 r2327 55 55 //WeaponSystem 56 56 weaponSystem_ = new WeaponSystem(this); 57 /* 57 58 WeaponSet * weaponSet1 = new WeaponSet(this,1); 58 59 this->weaponSystem_->attachWeaponSet(weaponSet1); 59 60 //totally bad solution... 60 61 weaponSet1->setParentWeaponSystem(weaponSystem_); 61 62 */ 62 63 63 64 this->registerVariables(); … … 157 158 158 159 void Pawn::setWeaponSlot(WeaponSlot * wSlot) 159 { this->weaponSystem_->attachWeaponSlot(wSlot); } 160 { 161 COUT(0) << "Pawn::setWeaponSlot" << std::endl; 162 this->weaponSystem_->attachWeaponSlot(wSlot); } 160 163 WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const 161 164 { return this->weaponSystem_->getWeaponSlotPointer(index); } 162 165 163 166 void Pawn::setWeaponPack(WeaponPack * wPack) 164 { this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); } 167 { 168 COUT(0) << "Pawn::setWeaponPack" << std::endl; 169 this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); } 165 170 WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const 166 171 { return this->weaponSystem_->getWeaponPackPointer(firemode); } 167 172 168 173 void Pawn::setWeaponSet(WeaponSet * wSet) 169 { this->weaponSystem_->attachWeaponSet(wSet); } 174 { 175 COUT(0) << "Pawn::setWeaponSet" << std::endl; 176 this->weaponSystem_->attachWeaponSet(wSet); } 170 177 WeaponSet * Pawn::getWeaponSet(unsigned int index) const 171 178 { return this->weaponSystem_->getWeaponSetPointer(index); }
Note: See TracChangeset
for help on using the changeset viewer.