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/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10768 r10821  
    6565        {
    6666            // Delete all children
    67             for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin();
    68                 it != this->attachedShapes_.end(); ++it)
     67            for (auto & elem : this->attachedShapes_)
    6968            {
    7069                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
    71                 it->first->notifyDetached();
    72                 it->first->destroy();
    73                 if (this->collisionShape_ == it->second)
     70                elem.first->notifyDetached();
     71                elem.first->destroy();
     72                if (this->collisionShape_ == elem.second)
    7473                    this->collisionShape_ = nullptr; // don't destroy it twice
    7574            }
     
    247246    {
    248247        unsigned int i = 0;
    249         for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
     248        for (const auto & elem : this->attachedShapes_)
    250249        {
    251250            if (i == index)
    252                 return it->first;
     251                return elem.first;
    253252            ++i;
    254253        }
     
    267266        std::vector<CollisionShape*> shapes;
    268267        // Iterate through all attached CollisionShapes and add them to the list of shapes.
    269         for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
    270             shapes.push_back(it->first);
     268        for(auto & elem : this->attachedShapes_)
     269            shapes.push_back(elem.first);
    271270
    272271        // Delete the compound shape and create a new one.
     
    275274
    276275        // Re-attach all CollisionShapes.
    277         for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
    278         {
    279             CollisionShape* shape = *it;
     276        for(auto shape : shapes)
     277        {
     278           
    280279            shape->setScale3D(this->getScale3D());
    281280            // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
Note: See TracChangeset for help on using the changeset viewer.