Changeset 10559 for code/branches/core7/src/modules/pickup
- Timestamp:
- Aug 29, 2015, 6:55:25 PM (9 years ago)
- Location:
- code/branches/core7/src/modules/pickup
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/modules/pickup/PickupManager.cc
r10478 r10559 96 96 97 97 // Destroying all the WeakPointers that are still there. 98 for(std::map<uint32_t, WeakPtr<Pickupable>*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)99 delete it->second;100 98 this->pickups_.clear(); 101 99 … … 288 286 // Add the Pickupable to the indexes_ and pickups_ lists. 289 287 this->indexes_[pickup] = index; 290 this->pickups_[index] = new WeakPtr<Pickupable>(pickup);288 this->pickups_[index] = pickup; 291 289 } 292 290 else // If it was dropped, it is removed from the required lists. … … 296 294 index = it->second; 297 295 298 // Remove the Pickupable form the indexes_ and pickups_ list. 299 WeakPtr<Pickupable>* ptr = this->pickups_[index]; 296 // Remove the Pickupable from the indexes_ and pickups_ list. 300 297 this->indexes_.erase(it); 301 298 this->pickups_.erase(index); 302 delete ptr;303 299 } 304 300 … … 402 398 if(this->pickups_.empty()) 403 399 return; 404 Pickupable* pickupable = this->pickups_.find(pickup)->second ->get();400 Pickupable* pickupable = this->pickups_.find(pickup)->second; 405 401 if(pickupable != NULL) 406 402 pickupable->drop(); … … 445 441 if(this->pickups_.empty()) 446 442 return; 447 Pickupable* pickupable = this->pickups_.find(pickup)->second ->get();443 Pickupable* pickupable = this->pickups_.find(pickup)->second; 448 444 if(pickupable != NULL) 449 445 pickupable->setUsed(use); -
code/branches/core7/src/modules/pickup/PickupManager.h
r9667 r10559 161 161 std::map<uint32_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_. 162 162 163 std::map<uint32_t, WeakPtr<Pickupable> *> pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.163 std::map<uint32_t, WeakPtr<Pickupable> > pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable. 164 164 std::map<Pickupable*, uint32_t> indexes_;//!< Map linking Pickupable to the number identifying it. 165 165
Note: See TracChangeset
for help on using the changeset viewer.