Changeset 11071 for code/trunk/src/modules/overlays/hud/HUDWeaponSystem.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/overlays/hud/HUDWeaponSystem.cc
r11052 r11071 103 103 bool visible = this->isVisible(); 104 104 105 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)105 for (HUDWeapon* hudWeapon : hudWeapons_) 106 106 { 107 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed108 (*it)->setVisible(visible);107 hudWeapon->changedVisibility(); //inform all Child Overlays that our visibility has changed 108 hudWeapon->setVisible(visible); 109 109 } 110 110 } … … 117 117 void HUDWeaponSystem::updateWeaponList() 118 118 { 119 if (owner_ == NULL)119 if (owner_ == nullptr) 120 120 { 121 121 return; … … 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(); 131 for (WeaponPack* weaponPack : weaponPacks) 132 { 133 const std::vector<Weapon*>& weapons = weaponPack->getAllWeapons(); 134 for (Weapon* weapon : weapons) 135 { 136 this->weapons_.push_back(weapon); 137 } 138 } 129 139 130 for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks->begin(); itPacks != weaponPacks->end(); ++itPacks) 131 { 132 std::vector<Weapon*>* weapons = (*itPacks)->getAllWeapons(); 133 134 for (std::vector<Weapon*>::const_iterator itWeapons = weapons->begin(); itWeapons != weapons->end(); ++itWeapons) 135 { 136 this->weapons_.push_back(*itWeapons); 137 } 140 createHUDChilds(); 141 positionHUDChilds(); 138 142 } 139 140 createHUDChilds();141 positionHUDChilds();142 143 } 143 144 … … 146 147 int positionIndex = 0; 147 148 148 for ( std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)149 for (Weapon* weapon : weapons_) 149 150 { 150 151 HUDWeapon* hudWeapon = new HUDWeapon(this->getContext()); … … 152 153 hudWeapon->setOverlayGroup(this->getOverlayGroup()); 153 154 hudWeapon->setVisible(this->isVisible()); 154 hudWeapon->setWeapon( *it);155 hudWeapon->setWeapon(weapon); 155 156 hudWeapon->setAspectCorrection(false); 156 157 hudWeapon->setPickPoint(Vector2(0.0f,0.0f)); … … 167 168 Vector2 offset = this->getPosition(); 168 169 169 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)170 for (HUDWeapon* hudWeapon : hudWeapons_) 170 171 { 171 (*it)->setPositionOffset(offset);172 (*it)->setWeaponIndex(positionIndex);173 (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);172 hudWeapon->setPositionOffset(offset); 173 hudWeapon->setWeaponIndex(positionIndex); 174 hudWeapon->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_); 174 175 175 176 ++ positionIndex; … … 179 180 void HUDWeaponSystem::destroyHUDChilds() 180 181 { 181 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)182 for (HUDWeapon* hudWeapon : hudWeapons_) 182 183 { 183 (*it)->destroy();184 hudWeapon->destroy(); 184 185 } 185 186
Note: See TracChangeset
for help on using the changeset viewer.