- Timestamp:
- Nov 4, 2015, 10:25:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/pickup/PickupSpawner.cc
r10624 r10765 55 55 Pointer to the object which created this item. 56 56 */ 57 PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_( NULL), representation_(NULL), pickupTemplate_(NULL)57 PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_(nullptr), representation_(nullptr), pickupTemplate_(nullptr) 58 58 { 59 59 RegisterObject(PickupSpawner); … … 74 74 this->selfDestruct_ = false; 75 75 76 this->setPickupable( NULL);76 this->setPickupable(nullptr); 77 77 } 78 78 … … 83 83 PickupSpawner::~PickupSpawner() 84 84 { 85 if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != NULL)85 if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != nullptr) 86 86 this->pickup_->destroy(); 87 87 } … … 160 160 for(ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 161 161 { 162 if(spawner == NULL) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).162 if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 163 163 break; 164 164 … … 166 166 PickupCarrier* carrier = static_cast<PickupCarrier*>(*it); 167 167 // 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. 168 if(distance.length() < this->triggerDistance_ && carrier != NULL&& this->blocked_.find(carrier) == this->blocked_.end())168 if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end()) 169 169 { 170 170 if(carrier->isTarget(this->pickup_)) … … 195 195 pickedUp = false; // To avoid compiler warning. 196 196 197 this->setPickupable( NULL);197 this->setPickupable(nullptr); 198 198 this->decrementSpawnsRemaining(); 199 199 } … … 282 282 { 283 283 orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl; 284 return NULL;285 } 286 287 if (this->pickupTemplate_ != NULL)284 return nullptr; 285 } 286 287 if (this->pickupTemplate_ != nullptr) 288 288 { 289 289 Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier(); 290 if (identifier != NULL)290 if (identifier != nullptr) 291 291 { 292 292 Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this->getContext())); … … 298 298 } 299 299 300 return NULL;300 return nullptr; 301 301 } 302 302 … … 309 309 void PickupSpawner::setPickupable(Pickupable* pickup) 310 310 { 311 if (this->representation_ != NULL)311 if (this->representation_ != nullptr) 312 312 { 313 313 this->representation_->destroy(); 314 this->representation_ = NULL;315 } 316 317 if (pickup != NULL)318 { 319 if (this->pickup_ != NULL)314 this->representation_ = nullptr; 315 } 316 317 if (pickup != nullptr) 318 { 319 if (this->pickup_ != nullptr) 320 320 this->pickup_->destroy(); 321 321
Note: See TracChangeset
for help on using the changeset viewer.