Changeset 10821 for code/branches/cpp11_v2/src/modules/pickup
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (10 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/pickup
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/pickup/PickupCollection.cc
r10765 r10821 68 68 { 69 69 // 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(auto & elem : this->pickups_) 71 { 72 (elem)->wasRemovedFromCollection(); 73 (elem)->destroy(); 74 74 } 75 75 this->pickups_.clear(); … … 99 99 this->processingUsed_ = true; 100 100 // 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(auto & elem : this->pickups_) 102 (elem)->setUsed(this->isUsed()); 103 103 104 104 this->processingUsed_ = false; … … 119 119 size_t numPickupsEnabled = 0; 120 120 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(auto & elem : this->pickups_) 122 { 123 if ((elem)->isEnabled()) 124 124 ++numPickupsEnabled; 125 if (( *it)->isUsed())125 if ((elem)->isUsed()) 126 126 ++numPickupsInUse; 127 127 } … … 146 146 147 147 // 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)148 for(auto & elem : this->pickups_) 149 149 { 150 150 if(this->getCarrier() == nullptr) 151 ( *it)->setCarrier(nullptr);151 (elem)->setCarrier(nullptr); 152 152 else 153 ( *it)->setCarrier(this->getCarrier()->getTarget(*it));153 (elem)->setCarrier(this->getCarrier()->getTarget(elem)); 154 154 } 155 155 } … … 186 186 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 187 187 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(auto & elem : this->pickups_) 189 { 190 if ((elem)->isEnabled() && (elem)->isPickedUp()) 191 191 { 192 192 isOnePickupEnabledAndPickedUp = true; … … 208 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 209 209 { 210 for( std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)211 { 212 if(!carrier->isTarget( *it))210 for(const auto & elem : this->pickups_) 211 { 212 if(!carrier->isTarget(elem)) 213 213 return false; 214 214 } -
code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc
r10765 r10821 91 91 92 92 // Destroying all the PickupInventoryContainers that are still there. 93 for( std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)94 delete it->second;93 for(auto & elem : this->pickupInventoryContainers_) 94 delete elem.second; 95 95 this->pickupInventoryContainers_.clear(); 96 96 -
code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc
r10765 r10821 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)120 for(auto pickup : pickups) 121 121 { 122 Pickupable* pickup = (*it);122 123 123 if(pickup == nullptr || pickup == this) 124 124 continue;
Note: See TracChangeset
for help on using the changeset viewer.