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/modules/invader
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/invader/Invader.cc

    r10768 r10919  
    9898        if (player == nullptr)
    9999        {
    100             for (ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)
    101                 player = *it;
     100            for (InvaderShip* ship : ObjectList<InvaderShip>())
     101                player = ship;
    102102        }
    103103        return player;
  • code/branches/cpp11_v2/src/modules/invader/InvaderEnemy.cc

    r10818 r10919  
    7575        if (game == nullptr)
    7676        {
    77             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    78                 game = *it;
     77            for (Invader* invader : ObjectList<Invader>())
     78                game = invader;
    7979        }
    8080        return game;
  • code/branches/cpp11_v2/src/modules/invader/InvaderShip.cc

    r10818 r10919  
    184184        if (game == nullptr)
    185185        {
    186             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    187                 game = *it;
     186            for (Invader* invader : ObjectList<Invader>())
     187                game = invader;
    188188        }
    189189        return game;
Note: See TracChangeset for help on using the changeset viewer.