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)

Location:
code/branches/cpp11_v2/src/orxonox/gamestates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc

    r10916 r10919  
    164164        // Note: Temporarily moved to GSRoot.
    165165        //// Call the scene objects
    166         //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
    167         //    it->tick(time.getDeltaTime() * this->timeFactor_);
     166        //for (Tickable* tickable : ObjectList<Tickable>())
     167        //    tickable->tick(time.getDeltaTime() * this->timeFactor_);
    168168    }
    169169
    170170    void GSLevel::prepareObjectTracking()
    171171    {
    172         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    173             this->staticObjects_.insert(*it);
     172        for (BaseObject* baseObject : ObjectList<BaseObject>())
     173            this->staticObjects_.insert(baseObject);
    174174    }
    175175
     
    178178        orxout(internal_info) << "Remaining objects:" << endl;
    179179        unsigned int i = 0;
    180         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    181         {
    182             std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(*it);
     180        for (BaseObject* baseObject : ObjectList<BaseObject>())
     181        {
     182            std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(baseObject);
    183183            if (find == this->staticObjects_.end())
    184184            {
    185                 orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
     185                orxout(internal_warning) << ++i << ": " << baseObject->getIdentifier()->getName() << " (" << baseObject << "), references: " << baseObject->getReferenceCount() << endl;
    186186            }
    187187        }
     
    235235        // export all states
    236236        std::vector<GSLevelMementoState*> states;
    237         for (ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)
    238         {
    239             GSLevelMementoState* state = it->exportMementoState();
     237        for (GSLevelMemento* memento : ObjectList<GSLevelMemento>())
     238        {
     239            GSLevelMementoState* state = memento->exportMementoState();
    240240            if (state)
    241241                states.push_back(state);
     
    247247
    248248        // import all states
    249         for (ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)
    250             it->importMementoState(states);
     249        for (GSLevelMemento* memento : ObjectList<GSLevelMemento>())
     250            memento->importMementoState(states);
    251251
    252252        // delete states
  • code/branches/cpp11_v2/src/orxonox/gamestates/GSRoot.cc

    r10818 r10919  
    7474    {
    7575        unsigned int nr=0;
    76         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it)
    77         {
    78             Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(*it);
     76        for (BaseObject* baseObject : ObjectList<BaseObject>())
     77        {
     78            Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(baseObject);
    7979            if (synchronisable)
    80                 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;
     80                orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;
    8181            else
    82                 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;
     82                orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << endl;
    8383            nr++;
    8484        }
Note: See TracChangeset for help on using the changeset viewer.