Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (10 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/worldentities/pawns/Pawn.cc

    r10768 r10919  
    574574    bool Pawn::hasSlaves()
    575575    {
    576         for (ObjectList<FormationController>::iterator it =
    577              ObjectList<FormationController>::begin();
    578              it != ObjectList<FormationController>::end(); ++it )
     576        for (FormationController* controller : ObjectList<FormationController>())
    579577        {
    580578            // checks if the pawn's controller has a slave
    581             if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
     579            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
    582580                return true;
    583581        }
     
    587585    // A function that returns a slave of the pawn's controller
    588586    Controller* Pawn::getSlave(){
    589         for (ObjectList<FormationController>::iterator it =
    590                 ObjectList<FormationController>::begin();
    591                 it != ObjectList<FormationController>::end(); ++it )
    592         {
    593             if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    594                 return it->getController();
     587        for (FormationController* controller : ObjectList<FormationController>())
     588        {
     589            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
     590                return controller->getController();
    595591        }
    596592        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.