Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/pong/Pong.cc

    r10768 r10821  
    145145
    146146            // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint.
    147             for (size_t i = 0; i < 2; ++i)
     147            for (auto & elem : this->bat_)
    148148            {
    149                 if (this->bat_[i] == nullptr)
     149                if (elem == nullptr)
    150150                {
    151                     this->bat_[i] = new PongBat(this->center_->getContext());
    152                     this->bat_[i]->addTemplate(this->center_->getBattemplate());
     151                    elem = new PongBat(this->center_->getContext());
     152                    elem->addTemplate(this->center_->getBattemplate());
    153153                }
    154154            }
     
    211211    {
    212212        // first spawn human players to assign always the left bat to the player in singleplayer
    213         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    214             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    215                 this->spawnPlayer(it->first);
     213        for (auto & elem : this->players_)
     214            if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     215                this->spawnPlayer(elem.first);
    216216        // now spawn bots
    217         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    218             if (!it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    219                 this->spawnPlayer(it->first);
     217        for (auto & elem : this->players_)
     218            if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     219                this->spawnPlayer(elem.first);
    220220    }
    221221
Note: See TracChangeset for help on using the changeset viewer.