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/pickup/PickupSpawner.cc

    r10765 r10919  
    158158
    159159            // Iterate trough all Pawns.
    160             for(ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     160            for(Pawn* pawn : ObjectList<Pawn>())
    161161            {
    162162                if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
    163163                    break;
    164164
    165                 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
    166                 PickupCarrier* carrier = static_cast<PickupCarrier*>(*it);
     165                Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition();
     166                PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn);
    167167                // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
    168168                if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end())
    169169                {
    170170                    if(carrier->isTarget(this->pickup_))
    171                         this->trigger(*it);
     171                        this->trigger(pawn);
    172172                }
    173173            }
Note: See TracChangeset for help on using the changeset viewer.