Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/modules/pickup/PickupCollection.cc

    r9667 r11054  
    6868    {
    6969        // Destroy all Pickupables constructing this PickupCollection.
    70         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    71         {
    72             (*it)->wasRemovedFromCollection();
    73             (*it)->destroy();
     70        for(CollectiblePickup* pickup : this->pickups_)
     71        {
     72            pickup->wasRemovedFromCollection();
     73            pickup->destroy();
    7474        }
    7575        this->pickups_.clear();
     
    9999        this->processingUsed_ = true;
    100100        // Change used for all Pickupables this PickupCollection consists of.
    101         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    102             (*it)->setUsed(this->isUsed());
     101        for(CollectiblePickup* pickup : this->pickups_)
     102            pickup->setUsed(this->isUsed());
    103103
    104104        this->processingUsed_ = false;
     
    119119        size_t numPickupsEnabled = 0;
    120120        size_t numPickupsInUse = 0;
    121         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    122         {
    123             if ((*it)->isEnabled())
     121        for(CollectiblePickup* pickup : this->pickups_)
     122        {
     123            if (pickup->isEnabled())
    124124                ++numPickupsEnabled;
    125             if ((*it)->isUsed())
     125            if (pickup->isUsed())
    126126                ++numPickupsInUse;
    127127        }
     
    146146
    147147        // Change the PickupCarrier for all Pickupables this PickupCollection consists of.
    148         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    149         {
    150             if(this->getCarrier() == NULL)
    151                 (*it)->setCarrier(NULL);
     148        for(CollectiblePickup* pickup : this->pickups_)
     149        {
     150            if(this->getCarrier() == nullptr)
     151                pickup->setCarrier(nullptr);
    152152            else
    153                 (*it)->setCarrier(this->getCarrier()->getTarget(*it));
     153                pickup->setCarrier(this->getCarrier()->getTarget(pickup));
    154154        }
    155155    }
     
    186186        // If at least all the enabled pickups of this PickupCollection are no longer picked up.
    187187        bool isOnePickupEnabledAndPickedUp = false;
    188         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    189         {
    190             if ((*it)->isEnabled() && (*it)->isPickedUp())
     188        for(CollectiblePickup* pickup : this->pickups_)
     189        {
     190            if (pickup->isEnabled() && pickup->isPickedUp())
    191191            {
    192192                isOnePickupEnabledAndPickedUp = true;
     
    208208    bool PickupCollection::isTarget(const PickupCarrier* carrier) const
    209209    {
    210         for(std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    211         {
    212             if(!carrier->isTarget(*it))
     210        for(CollectiblePickup* pickup : this->pickups_)
     211        {
     212            if(!carrier->isTarget(pickup))
    213213                return false;
    214214        }
     
    227227    bool PickupCollection::addPickupable(CollectiblePickup* pickup)
    228228    {
    229         if(pickup == NULL)
     229        if(pickup == nullptr)
    230230            return false;
    231231
     
    247247    {
    248248        if(this->pickups_.size() >= index)
    249             return NULL;
     249            return nullptr;
    250250
    251251        std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin();
Note: See TracChangeset for help on using the changeset viewer.