Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/weaponsystem/WeaponPack.cc

    r11052 r11071  
    4444        RegisterObject(WeaponPack);
    4545
    46         this->weaponSystem_ = 0;
     46        this->weaponSystem_ = nullptr;
    4747    }
    4848
     
    7676    void WeaponPack::fire(unsigned int weaponmode)
    7777    {
    78         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    79             (*it)->fire(weaponmode);
     78        for (Weapon* weapon : this->weapons_)
     79            weapon->fire(weaponmode);
    8080    }
    8181
     
    8686    void WeaponPack::reload()
    8787    {
    88         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    89             (*it)->reload();
     88        for (Weapon* weapon : this->weapons_)
     89            weapon->reload();
    9090    }
    9191
     
    107107        assert(it != this->weapons_.end());
    108108        this->weapons_.erase(it);
    109         weapon->setWeaponPack(0);
     109        weapon->setWeaponPack(nullptr);
    110110    }
    111111
     
    114114        unsigned int i = 0;
    115115
    116         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     116        for (Weapon* weapon : this->weapons_)
    117117        {
    118118            if (i == index)
    119                 return (*it);
     119                return weapon;
    120120            ++i;
    121121        }
    122122
    123         return 0;
     123        return nullptr;
    124124    }
    125 
    126     std::vector<Weapon*>* WeaponPack::getAllWeapons()
    127     {
    128         return &weapons_;       
    129     }   
    130125
    131126    void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
     
    137132    {
    138133        unsigned int i = 0;
    139         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
     134        for (DefaultWeaponmodeLink* link : this->links_)
    140135        {
    141136            if (i == index)
    142                 return (*it);
     137                return link;
    143138
    144139            ++i;
    145140        }
    146         return 0;
     141        return nullptr;
    147142    }
    148143
    149144    unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
    150145    {
    151         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
    152             if ((*it)->getFiremode() == firemode)
    153                 return (*it)->getWeaponmode();
     146        for (DefaultWeaponmodeLink* link : this->links_)
     147            if (link->getFiremode() == firemode)
     148                return link->getWeaponmode();
    154149
    155150        return WeaponSystem::WEAPON_MODE_UNASSIGNED;
     
    158153    void WeaponPack::notifyWeapons()
    159154    {
    160         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    161             (*it)->setWeaponPack(this);
     155        for (Weapon* weapon : this->weapons_)
     156            weapon->setWeaponPack(this);
    162157    }
    163158
    164159    void WeaponPack::updateMunition()
    165160    {
    166         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    167             (*it)->updateMunition();
     161        for (Weapon* weapon : this->weapons_)
     162            weapon->updateMunition();
    168163    }
    169164}
Note: See TracChangeset for help on using the changeset viewer.