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/docking/Dock.cc

    r10916 r10919  
    214214    {
    215215        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    216         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    217         {
    218             if(it->dock(player))
     216        for(Dock* dock : ObjectList<Dock>())
     217        {
     218            if(dock->dock(player))
    219219                break;
    220220        }
     
    224224    {
    225225        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    226         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    227         {
    228             if(it->undock(player))
     226        for(Dock* dock : ObjectList<Dock>())
     227        {
     228            if(dock->undock(player))
    229229                break;
    230230        }
     
    295295        int i = 0;
    296296        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    297         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    298         {
    299             if(it->candidates_.find(player) != it->candidates_.end())
     297        for(Dock* dock : ObjectList<Dock>())
     298        {
     299            if(dock->candidates_.find(player) != dock->candidates_.end())
    300300                i++;
    301301        }
     
    306306    {
    307307        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    308         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    309         {
    310             if(it->candidates_.find(player) != it->candidates_.end())
     308        for(Dock* dock : ObjectList<Dock>())
     309        {
     310            if(dock->candidates_.find(player) != dock->candidates_.end())
    311311            {
    312312                if(index == 0)
    313                     return *it;
     313                    return dock;
    314314                index--;
    315315            }
Note: See TracChangeset for help on using the changeset viewer.