Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 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/modules/objects/controllers/TurretController.cc

    r10818 r10919  
    103103        Pawn* minScorePawn = nullptr;
    104104
    105         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    106         {
    107             Pawn* entity = orxonox_cast<Pawn*>(*it);
    108             if (!entity || FormationController::sameTeam(turret, entity, this->getGametype()))
     105        for (Pawn* pawn : ObjectList<Pawn>())
     106        {
     107            if (!pawn || FormationController::sameTeam(turret, pawn, this->getGametype()))
    109108                continue;
    110             tempScore = turret->isInRange(entity);
     109            tempScore = turret->isInRange(pawn);
    111110            if(tempScore != -1.f)
    112111            {
     
    114113                {
    115114                    minScore = tempScore;
    116                     minScorePawn = entity;
     115                    minScorePawn = pawn;
    117116                }
    118117            }
Note: See TracChangeset for help on using the changeset viewer.