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/libraries/core/input/KeyBinder.cc

    r10772 r10821  
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (unsigned int i = 0; i < allHalfAxes_.size(); i++)
    156             if (!allHalfAxes_[i]->bButtonThresholdUser_)
    157                 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;
     155        for (auto & elem : allHalfAxes_)
     156            if (!elem->bButtonThresholdUser_)
     157                elem->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    383383            it->second->clear();
    384384
    385         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
    386             delete paramCommandBuffer_[i];
     385        for (auto & elem : paramCommandBuffer_)
     386            delete elem;
    387387        paramCommandBuffer_.clear();
    388388    }
     
    394394    {
    395395        // iterate over all buttons
    396         for (std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)
    397         {
    398             Button* button = it->second;
     396        for (const auto & elem : this->allButtons_)
     397        {
     398            Button* button = elem.second;
    399399
    400400            // iterate over all modes
     
    465465        this->mousePosition_[1] = 0.0f;
    466466
    467         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    468             mouseAxes_[i].reset();
     467        for (auto & elem : mouseAxes_)
     468            elem.reset();
    469469    }
    470470
     
    505505        }
    506506
    507         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
     507        for (auto & elem : mouseAxes_)
    508508        {
    509509            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    515515            {
    516516                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    517                 mouseAxes_[i].relVal_ /= dt;
    518             }
    519 
    520             tickHalfAxis(mouseAxes_[i]);
     517                elem.relVal_ /= dt;
     518            }
     519
     520            tickHalfAxis(elem);
    521521        }
    522522    }
Note: See TracChangeset for help on using the changeset viewer.