Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (9 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
Location:
code/branches/cpp11_v2/src/modules/docking
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/docking/Dock.cc

    r10765 r10821  
    327327    const DockingEffect* Dock::getEffect(unsigned int i) const
    328328    {
    329         for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
     329        for (const auto & elem : this->effects_)
    330330        {
    331331            if(i == 0)
    332                return *effect;
     332               return elem;
    333333            i--;
    334334        }
     
    346346    const DockingAnimation* Dock::getAnimation(unsigned int i) const
    347347    {
    348         for (std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)
     348        for (const auto & elem : this->animations_)
    349349        {
    350350            if(i == 0)
    351                return *animation;
     351               return elem;
    352352            i--;
    353353        }
  • code/branches/cpp11_v2/src/modules/docking/DockingAnimation.cc

    r10765 r10821  
    5757        bool check = true;
    5858
    59         for (std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)
     59        for (auto & animations_animation : animations)
    6060        {
    6161            if(dock)
    62                 check &= (*animation)->docking(player);
     62                check &= (animations_animation)->docking(player);
    6363            else
    64                 check &= (*animation)->release(player);
     64                check &= (animations_animation)->release(player);
    6565        }
    6666
  • code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc

    r10765 r10821  
    5353        bool check = true;
    5454
    55         for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
     55        for (auto & effects_effect : effects)
    5656        {
    5757            if (dock)
    58                 check &= (*effect)->docking(player);
     58                check &= (effects_effect)->docking(player);
    5959            else
    60                 check &= (*effect)->release(player);
     60                check &= (effects_effect)->release(player);
    6161        }
    6262
Note: See TracChangeset for help on using the changeset viewer.