Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc

    r11052 r11054  
    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    }
    125125
     
    137137    {
    138138        unsigned int i = 0;
    139         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
     139        for (DefaultWeaponmodeLink* link : this->links_)
    140140        {
    141141            if (i == index)
    142                 return (*it);
     142                return link;
    143143
    144144            ++i;
    145145        }
    146         return 0;
     146        return nullptr;
    147147    }
    148148
    149149    unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
    150150    {
    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();
     151        for (DefaultWeaponmodeLink* link : this->links_)
     152            if (link->getFiremode() == firemode)
     153                return link->getWeaponmode();
    154154
    155155        return WeaponSystem::WEAPON_MODE_UNASSIGNED;
     
    158158    void WeaponPack::notifyWeapons()
    159159    {
    160         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    161             (*it)->setWeaponPack(this);
     160        for (Weapon* weapon : this->weapons_)
     161            weapon->setWeaponPack(this);
    162162    }
    163163
Note: See TracChangeset for help on using the changeset viewer.