Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 13, 2016, 10:19:21 PM (8 years ago)
Author:
landauf
Message:

return const-ref to collections instead of pointer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponSystem.cc

    r11054 r11059  
    126126        destroyHUDChilds();
    127127
    128         std::vector<WeaponPack*>* weaponPacks = owner_->getAllWeaponPacks();
     128        if (owner_->getWeaponSystem())
     129        {
     130            const std::vector<WeaponPack*>& weaponPacks = owner_->getWeaponSystem()->getAllWeaponPacks();
    129131
    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();
    133135
    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                }
    137140            }
     141
     142            createHUDChilds();
     143            positionHUDChilds();
    138144        }
    139 
    140         createHUDChilds();
    141         positionHUDChilds();
    142145    }
    143146
Note: See TracChangeset for help on using the changeset viewer.