Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 11, 2012, 10:40:01 PM (12 years ago)
Author:
dafrick
Message:

Looked through recten changes in pickup module, should be fine!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc

    r9290 r9292  
    273273    const Pickupable* PickupCollection::getPickupable(unsigned int index) const
    274274    {
    275         unsigned int count = 0;
    276         for (std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    277         {
    278             if (count == index)
    279                 return *it;
    280             else
    281                 ++count;
    282         }
    283         return NULL;
     275        if(this->pickups_.size() >= index)
     276            return NULL;
     277
     278        std::list<CollectiblePickup*>::iterator it = this->pickups_.begin();
     279        std::advance(it, index);
     280        return *it;
    284281    }
    285282
Note: See TracChangeset for help on using the changeset viewer.