Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

return const-ref to collections instead of pointer

Location:
code/branches/cpp11_v3/src/orxonox/weaponsystem
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.h

    r11054 r11059  
    5757            void addWeaponmode(WeaponMode* weaponmode);
    5858            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_; }
    6161            inline int getNumWeaponModes() const
    6262                { return weaponmodes_.size(); }
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc

    r11054 r11059  
    124124    }
    125125
    126     std::vector<Weapon*>* WeaponPack::getAllWeapons()
    127     {
    128         return &weapons_;       
    129     }   
    130 
    131126    void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
    132127    {
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.h

    r11054 r11059  
    5252            void removeWeapon(Weapon * weapon);
    5353            Weapon * getWeapon(unsigned int index) const;
    54             std::vector<Weapon*>* getAllWeapons();
     54            inline const std::vector<Weapon*>& getAllWeapons() const
     55                { return weapons_; }
    5556
    5657            inline size_t getNumWeapons() const
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc

    r11054 r11059  
    240240    }
    241241
    242     std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks()
    243     {
    244         return &weaponPacks_;
    245     }   
    246 
    247242    bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
    248243    {
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.h

    r11052 r11059  
    6767            void removeWeaponPack(WeaponPack * wPack);
    6868            WeaponPack * getWeaponPack(unsigned int index) const;
    69             std::vector<WeaponPack *> * getAllWeaponPacks();
     69            inline const std::vector<WeaponPack *>& getAllWeaponPacks() const
     70                { return weaponPacks_; }
    7071
    7172            // configure slots and firemodes
Note: See TracChangeset for help on using the changeset viewer.