Changeset 8891 for code/trunk/src/modules/pickup
- Timestamp:
- Oct 12, 2011, 7:50:43 PM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/modules/pickup/PickupSpawner.cc
r8858 r8891 181 181 if(GameMode::isMaster() && this->isActive()) 182 182 { 183 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)183 WeakPtr<PickupSpawner> spawner = this; // Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 184 184 185 185 // Remove PickupCarriers from the blocked list if they have exceeded their time. … … 195 195 for(ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 196 196 { 197 if(spawner == NULL) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 198 break; 199 197 200 Vector3 distance = it->getWorldPosition() - this->getWorldPosition(); 198 201 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(*it); 199 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawn der, is in trigger-distance and the carrier is not blocked.202 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked. 200 203 if(distance.length() < this->triggerDistance_ && carrier != NULL && this->blocked_.find(carrier) == this->blocked_.end()) 201 204 {
Note: See TracChangeset
for help on using the changeset viewer.