Changeset 8819 for code/branches/ai2/src/modules/pickup
- Timestamp:
- Aug 3, 2011, 9:54:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/modules/pickup/PickupSpawner.cc
r7801 r8819 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.