Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (8 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/controllers/WaypointPatrolController.cc

    r10768 r10919  
    8787        float shortestsqdistance = (float)static_cast<unsigned int>(-1);
    8888
    89         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     89        for (Pawn* pawn : ObjectList<Pawn>())
    9090        {
    91             if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
     91            if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype()))
    9292                continue;
    9393
    94             float sqdistance = it->getPosition().squaredDistance(myposition);
     94            float sqdistance = pawn->getPosition().squaredDistance(myposition);
    9595            if (sqdistance < shortestsqdistance)
    9696            {
    9797                shortestsqdistance = sqdistance;
    98                 this->target_ = (*it);
     98                this->target_ = pawn;
    9999            }
    100100        }
Note: See TracChangeset for help on using the changeset viewer.