Changeset 11059 for code/branches/cpp11_v3/src/modules
- Timestamp:
- Jan 13, 2016, 10:19:21 PM (9 years ago)
- Location:
- code/branches/cpp11_v3/src/modules/overlays/hud
- Files:
-
- 3 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
Note: See TracChangeset
for help on using the changeset viewer.