Changeset 11059
- Timestamp:
- Jan 13, 2016, 10:19:21 PM (9 years ago)
- Location:
- code/branches/cpp11_v3/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeapon.cc
r11054 r11059 44 44 weaponModeHUDActualSize_ = Vector2(0.0f,0.0f); 45 45 46 weaponModes_ = NULL;47 46 weaponIndex_ = 0; 48 47 hudWeaponModes_.clear(); … … 148 147 destroyHUDChilds(); 149 148 150 weaponModes_ = weapon_->getAllWeaponmodes();151 152 149 updateSize(); 153 150 createHUDChilds(); … … 157 154 void HUDWeapon::createHUDChilds() 158 155 { 159 if (weapon Modes_ == NULL)156 if (weapon_ == NULL) 160 157 { 161 158 return; … … 164 161 int positionIndex = 0; 165 162 166 for (std::multimap<unsigned int, WeaponMode*>:: iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)163 for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = weapon_->getAllWeaponmodes().begin(); it != weapon_->getAllWeaponmodes().end(); ++it) 167 164 { 168 165 HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext()); … … 208 205 void HUDWeapon::updateSize() 209 206 { 210 if (weapon Modes_ != NULL)211 { 212 this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon Modes_->size()));207 if (weapon_ != NULL) 208 { 209 this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon_->getAllWeaponmodes().size())); 213 210 updatePosition(); 214 211 } … … 217 214 void HUDWeapon::updatePosition() 218 215 { 219 if (weapon Modes_ != NULL)216 if (weapon_ != NULL) 220 217 { 221 218 this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f) + this->positionOffset_); -
code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeapon.h
r11052 r11059 94 94 WeakPtr<Weapon> weapon_; 95 95 96 std::multimap<unsigned int, WeaponMode*>* weaponModes_;97 96 std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_; 98 97 -
code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponSystem.cc
r11054 r11059 126 126 destroyHUDChilds(); 127 127 128 std::vector<WeaponPack*>* weaponPacks = owner_->getAllWeaponPacks(); 128 if (owner_->getWeaponSystem()) 129 { 130 const std::vector<WeaponPack*>& weaponPacks = owner_->getWeaponSystem()->getAllWeaponPacks(); 129 131 130 for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks->begin(); itPacks != weaponPacks->end(); ++itPacks)131 {132 std::vector<Weapon*>*weapons = (*itPacks)->getAllWeapons();132 for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks.begin(); itPacks != weaponPacks.end(); ++itPacks) 133 { 134 const std::vector<Weapon*>& weapons = (*itPacks)->getAllWeapons(); 133 135 134 for (std::vector<Weapon*>::const_iterator itWeapons = weapons->begin(); itWeapons != weapons->end(); ++itWeapons) 135 { 136 this->weapons_.push_back(*itWeapons); 136 for (std::vector<Weapon*>::const_iterator itWeapons = weapons.begin(); itWeapons != weapons.end(); ++itWeapons) 137 { 138 this->weapons_.push_back(*itWeapons); 139 } 137 140 } 141 142 createHUDChilds(); 143 positionHUDChilds(); 138 144 } 139 140 createHUDChilds();141 positionHUDChilds();142 145 } 143 146 -
code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.h
r11054 r11059 57 57 void addWeaponmode(WeaponMode* weaponmode); 58 58 WeaponMode* getWeaponmode(unsigned int index) const; 59 inline std::multimap<unsigned int, WeaponMode*>* getAllWeaponmodes()60 { return &weaponmodes_; }59 inline const std::multimap<unsigned int, WeaponMode*>& getAllWeaponmodes() const 60 { return weaponmodes_; } 61 61 inline int getNumWeaponModes() const 62 62 { return weaponmodes_.size(); } -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc
r11054 r11059 124 124 } 125 125 126 std::vector<Weapon*>* WeaponPack::getAllWeapons()127 {128 return &weapons_;129 }130 131 126 void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link) 132 127 { -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.h
r11054 r11059 52 52 void removeWeapon(Weapon * weapon); 53 53 Weapon * getWeapon(unsigned int index) const; 54 std::vector<Weapon*>* getAllWeapons(); 54 inline const std::vector<Weapon*>& getAllWeapons() const 55 { return weapons_; } 55 56 56 57 inline size_t getNumWeapons() const -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc
r11054 r11059 240 240 } 241 241 242 std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks()243 {244 return &weaponPacks_;245 }246 247 242 bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2) 248 243 { -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.h
r11052 r11059 67 67 void removeWeaponPack(WeaponPack * wPack); 68 68 WeaponPack * getWeaponPack(unsigned int index) const; 69 std::vector<WeaponPack *> * getAllWeaponPacks(); 69 inline const std::vector<WeaponPack *>& getAllWeaponPacks() const 70 { return weaponPacks_; } 70 71 71 72 // configure slots and firemodes -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc
r11054 r11059 513 513 } 514 514 515 std::vector<WeaponPack *> * Pawn::getAllWeaponPacks()516 {517 if (this->weaponSystem_)518 return this->weaponSystem_->getAllWeaponPacks();519 else520 return 0;521 }522 523 515 void Pawn::addMunitionXML(Munition* munition) 524 516 { -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.h
r11054 r11059 170 170 void addWeaponPackXML(WeaponPack * wPack); 171 171 WeaponPack * getWeaponPack(unsigned int index) const; 172 std::vector<WeaponPack *> * getAllWeaponPacks();173 172 174 173 void addMunitionXML(Munition* munition);
Note: See TracChangeset
for help on using the changeset viewer.