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/orxonox/overlays/OverlayGroup.cc

    r10916 r10919  
    170170    /*static*/ void OverlayGroup::toggleVisibility(const std::string& name)
    171171    {
    172         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    173         {
    174             if ((*it)->getName() == name)
    175                 (*it)->setVisible(!((*it)->isVisible()));
     172        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     173        {
     174            if (group->getName() == name)
     175                group->setVisible(!(group->isVisible()));
    176176        }
    177177    }
     
    185185    /*static*/ void OverlayGroup::show(const std::string& name)
    186186    {
    187         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    188         {
    189             if ((*it)->getName() == name)
     187        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     188        {
     189            if (group->getName() == name)
    190190            {
    191                 if((*it)->isVisible())
    192                     (*it)->changedVisibility();
     191                if(group->isVisible())
     192                    group->changedVisibility();
    193193                else
    194                     (*it)->setVisible(!((*it)->isVisible()));
     194                    group->setVisible(!(group->isVisible()));
    195195            }
    196196        }
     
    208208    /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale)
    209209    {
    210         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    211         {
    212             if ((*it)->getName() == name)
    213                 (*it)->scale(Vector2(scale, scale));
     210        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     211        {
     212            if (group->getName() == name)
     213                group->scale(Vector2(scale, scale));
    214214        }
    215215    }
     
    226226    /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll)
    227227    {
    228         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    229         {
    230             if ((*it)->getName() == name)
    231                 (*it)->scroll(scroll);
     228        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     229        {
     230            if (group->getName() == name)
     231                group->scroll(scroll);
    232232        }
    233233    }
Note: See TracChangeset for help on using the changeset viewer.