- Timestamp:
- Aug 8, 2010, 8:53:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/pickup/PickupSpawner.cc
r7150 r7162 107 107 this->maxSpawnedItems_ = INF; 108 108 this->spawnsRemaining_ = INF; 109 this->selfDestruct_ = false; 109 110 } 110 111 … … 115 116 PickupSpawner::~PickupSpawner() 116 117 { 117 if(this-> pickup_ != NULL)118 if(this->selfDestruct_ && this->pickup_ != NULL) 118 119 this->pickup_->destroy(); 119 120 } … … 176 177 if (this->isActive()) 177 178 { 178 SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)179 SmartPtr<PickupSpawner> temp = this; //Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 179 180 180 181 //! Iterate trough all Pawns. … … 305 306 { 306 307 if(pickup->pickup(target)) 307 {308 308 this->decrementSpawnsRemaining(); 309 }310 309 else 311 310 { 311 this->selfDestruct_ = true; 312 312 pickup->destroy(); 313 313 } … … 319 319 320 320 if(pickup == NULL) 321 {322 321 COUT(1) << "PickupSpawner (&" << this << "): getPickup produced an error, no Pickupable created." << std::endl; 323 }324 322 else 325 323 { 324 this->selfDestruct_ = true; 326 325 pickup->destroy(); 327 326 }
Note: See TracChangeset
for help on using the changeset viewer.