- Timestamp:
- Apr 9, 2009, 3:18:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc
r2893 r2912 27 27 28 28 #include "OrxonoxStableHeaders.h" 29 30 #include <vector> 29 #include "WeaponPack.h" 31 30 32 31 #include "core/CoreIncludes.h" 33 32 #include "core/XMLPort.h" 34 #include " util/Debug.h"33 #include "objects/worldentities/pawns/Pawn.h" 35 34 36 #include "Weapon Pack.h"37 #include " objects/worldentities/pawns/Pawn.h"35 #include "Weapon.h" 36 #include "WeaponSlot.h" 38 37 39 38 namespace orxonox … … 45 44 RegisterObject(WeaponPack); 46 45 47 this-> parentWeaponSystem_ = 0;46 this->weaponSystem_ = 0; 48 47 this->firemode_ = 0; 49 48 49 COUT(0) << "+WeaponPack" << std::endl; 50 50 } 51 51 52 52 WeaponPack::~WeaponPack() 53 53 { 54 COUT(0) << "~WeaponPack" << std::endl; 54 55 } 55 56 56 int WeaponPack::getSize() 57 void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode) 58 { 59 SUPER(WeaponPack, XMLPort, xmlelement, mode); 60 61 XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode); 62 XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode); 63 } 64 65 int WeaponPack::getSize() const 57 66 { 58 67 return this->weapons_.size(); … … 67 76 } 68 77 69 Weapon * WeaponPack::getWeaponPointer(unsigned int n) 78 Weapon * WeaponPack::getWeaponPointer(unsigned int n) const 70 79 { 71 80 return this->weapons_[n]; 72 }73 74 void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)75 {76 SUPER(WeaponPack, XMLPort, xmlelement, mode);77 78 XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode);79 XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode);80 81 } 81 82 … … 85 86 } 86 87 87 unsigned int WeaponPack::getFireMode() 88 unsigned int WeaponPack::getFireMode() const 88 89 { 89 90 return this->firemode_; … … 95 96 } 96 97 97 const Weapon * WeaponPack::getWeapon(unsigned int index) 98 const Weapon * WeaponPack::getWeapon(unsigned int index) const 98 99 { 99 100 return weapons_[index]; 100 101 } 101 102 102 void WeaponPack::set ParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem)103 void WeaponPack::setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem) 103 104 { 104 for (int i=0; i < (int) this->weapons_.size(); i++) 105 { 106 this->weapons_[i]->setParentWeaponSystem(weaponSystem); 107 } 108 105 for (size_t i = 0; i < this->weapons_.size(); i++) 106 this->weapons_[i]->setWeaponSystem(weaponSystem); 109 107 } 110 108 111 109 void WeaponPack::attachNeededMunitionToAllWeapons() 112 110 { 113 for ( int i=0; i < (int)this->weapons_.size(); i++)111 for (size_t i = 0; i < this->weapons_.size(); i++) 114 112 { 115 113 this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType()); 116 114 this->weapons_[i]->setWeapon(); 117 115 } 118 119 116 } 120 121 117 }
Note: See TracChangeset
for help on using the changeset viewer.