Changeset 11071 for code/trunk/src/modules/pickup
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/pickup/CollectiblePickup.cc
r10624 r11071 47 47 Registers the object and initializes variables. 48 48 */ 49 CollectiblePickup::CollectiblePickup() : collection_( NULL)49 CollectiblePickup::CollectiblePickup() : collection_(nullptr) 50 50 { 51 51 RegisterObject(CollectiblePickup); … … 103 103 void CollectiblePickup::wasRemovedFromCollection(void) 104 104 { 105 this->collection_ = NULL;105 this->collection_ = nullptr; 106 106 } 107 107 } -
code/trunk/src/modules/pickup/CollectiblePickup.h
r9348 r11071 61 61 virtual ~CollectiblePickup(); //! Destructor. 62 62 63 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.64 virtual void changedPickedUp(void) ; //!< Is called when the pickup has transited from picked up to dropped or the other way around.63 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 64 virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around. 65 65 66 66 /** … … 69 69 */ 70 70 bool isInCollection(void) const 71 { return this->collection_ != NULL; }71 { return this->collection_ != nullptr; } 72 72 73 73 private: -
code/trunk/src/modules/pickup/Pickup.cc
r9667 r11071 78 78 void Pickup::initialize(void) 79 79 { 80 this->activationType_ = pickupActivationType::immediate;81 this->durationType_ = pickupDurationType::once;80 this->activationType_ = PickupActivationType::immediate; 81 this->durationType_ = PickupDurationType::once; 82 82 } 83 83 … … 105 105 switch(this->getActivationType()) 106 106 { 107 case pickupActivationType::immediate:107 case PickupActivationType::immediate: 108 108 return activationTypeImmediate_s; 109 case pickupActivationType::onUse:109 case PickupActivationType::onUse: 110 110 return activationTypeOnUse_s; 111 111 default: … … 124 124 switch(this->getDurationType()) 125 125 { 126 case pickupDurationType::once:126 case PickupDurationType::once: 127 127 return durationTypeOnce_s; 128 case pickupDurationType::continuous:128 case PickupDurationType::continuous: 129 129 return durationTypeContinuous_s; 130 130 default: … … 142 142 { 143 143 if(type == Pickup::activationTypeImmediate_s) 144 this->setActivationType( pickupActivationType::immediate);144 this->setActivationType(PickupActivationType::immediate); 145 145 else if(type == Pickup::activationTypeOnUse_s) 146 this->setActivationType( pickupActivationType::onUse);146 this->setActivationType(PickupActivationType::onUse); 147 147 else 148 148 orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 158 158 { 159 159 if(type == Pickup::durationTypeOnce_s) 160 this->setDurationType( pickupDurationType::once);160 this->setDurationType(PickupDurationType::once); 161 161 else if(type == Pickup::durationTypeContinuous_s) 162 this->setDurationType( pickupDurationType::continuous);162 this->setDurationType(PickupDurationType::continuous); 163 163 else 164 164 orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; -
code/trunk/src/modules/pickup/Pickup.h
r9667 r11071 53 53 @ingroup Pickup 54 54 */ 55 namespace pickupActivationType55 enum class PickupActivationType 56 56 { 57 enum Value 58 { 59 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 60 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 61 }; 62 } 57 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 58 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 59 }; 63 60 64 61 /** … … 68 65 @ingroup Pickup 69 66 */ 70 namespace pickupDurationType67 enum class PickupDurationType 71 68 { 72 enum Value 73 { 74 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 75 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 76 }; 77 } 69 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 70 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 71 }; 78 72 79 73 /** … … 103 97 virtual ~Pickup(); //!< Destructor. 104 98 105 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;99 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 106 100 107 virtual const std::string& getRepresentationName() const 101 virtual const std::string& getRepresentationName() const override 108 102 { return this->representationName_; } 109 103 … … 112 106 @return Returns the activation type of the Pickup. 113 107 */ 114 inline pickupActivationType::Value getActivationType(void) const108 inline PickupActivationType getActivationType(void) const 115 109 { return this->activationType_; } 116 110 /** … … 118 112 @return Returns the duration type of the Pickup. 119 113 */ 120 inline pickupDurationType::Value getDurationType(void) const114 inline PickupDurationType getDurationType(void) const 121 115 { return this->durationType_; } 122 116 … … 129 123 */ 130 124 inline bool isImmediate(void) const 131 { return this->getActivationType() == pickupActivationType::immediate; }125 { return this->getActivationType() == PickupActivationType::immediate; } 132 126 /** 133 127 @brief Get whether the activation type is 'onUse'. … … 135 129 */ 136 130 inline bool isOnUse(void) const 137 { return this->getActivationType() == pickupActivationType::onUse; }131 { return this->getActivationType() == PickupActivationType::onUse; } 138 132 /** 139 133 @brief Get whether the duration type is 'once'. … … 141 135 */ 142 136 inline bool isOnce(void) const 143 { return this->getDurationType() == pickupDurationType::once; }137 { return this->getDurationType() == PickupDurationType::once; } 144 138 /** 145 139 @brief Get whether the duration type is 'continuous'. … … 147 141 */ 148 142 inline bool isContinuous(void) const 149 { return this->getDurationType() == pickupDurationType::continuous; }143 { return this->getDurationType() == PickupDurationType::continuous; } 150 144 151 virtual void changedPickedUp(void) ; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.145 virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around. 152 146 153 147 protected: 154 virtual bool createSpawner(void) ; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.148 virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 155 149 156 150 /** … … 164 158 @param type The activation type of the Pickup. 165 159 */ 166 inline void setActivationType( pickupActivationType::Value type)160 inline void setActivationType(PickupActivationType type) 167 161 { this->activationType_ = type; } 168 162 /** … … 170 164 @param type The duration type of the Pickup. 171 165 */ 172 inline void setDurationType( pickupDurationType::Value type)166 inline void setDurationType(PickupDurationType type) 173 167 { this->durationType_ = type; } 174 168 … … 180 174 181 175 std::string representationName_; //!< The name of the associated PickupRepresentation. 182 pickupActivationType::Value activationType_; //!< The activation type of the Pickup.183 pickupDurationType::Value durationType_; //!< The duration type of the Pickup.176 PickupActivationType activationType_; //!< The activation type of the Pickup. 177 PickupDurationType durationType_; //!< The duration type of the Pickup. 184 178 185 179 //! Strings for the activation and duration types. -
code/trunk/src/modules/pickup/PickupCollection.cc
r9667 r11071 68 68 { 69 69 // Destroy all Pickupables constructing this PickupCollection. 70 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)71 { 72 (*it)->wasRemovedFromCollection();73 (*it)->destroy();70 for(CollectiblePickup* pickup : this->pickups_) 71 { 72 pickup->wasRemovedFromCollection(); 73 pickup->destroy(); 74 74 } 75 75 this->pickups_.clear(); … … 99 99 this->processingUsed_ = true; 100 100 // Change used for all Pickupables this PickupCollection consists of. 101 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)102 (*it)->setUsed(this->isUsed());101 for(CollectiblePickup* pickup : this->pickups_) 102 pickup->setUsed(this->isUsed()); 103 103 104 104 this->processingUsed_ = false; … … 119 119 size_t numPickupsEnabled = 0; 120 120 size_t numPickupsInUse = 0; 121 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)122 { 123 if ( (*it)->isEnabled())121 for(CollectiblePickup* pickup : this->pickups_) 122 { 123 if (pickup->isEnabled()) 124 124 ++numPickupsEnabled; 125 if ( (*it)->isUsed())125 if (pickup->isUsed()) 126 126 ++numPickupsInUse; 127 127 } … … 146 146 147 147 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 148 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)149 { 150 if(this->getCarrier() == NULL)151 (*it)->setCarrier(NULL);148 for(CollectiblePickup* pickup : this->pickups_) 149 { 150 if(this->getCarrier() == nullptr) 151 pickup->setCarrier(nullptr); 152 152 else 153 (*it)->setCarrier(this->getCarrier()->getTarget(*it));153 pickup->setCarrier(this->getCarrier()->getTarget(pickup)); 154 154 } 155 155 } … … 186 186 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 187 187 bool isOnePickupEnabledAndPickedUp = false; 188 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)189 { 190 if ( (*it)->isEnabled() && (*it)->isPickedUp())188 for(CollectiblePickup* pickup : this->pickups_) 189 { 190 if (pickup->isEnabled() && pickup->isPickedUp()) 191 191 { 192 192 isOnePickupEnabledAndPickedUp = true; … … 208 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 209 209 { 210 for( std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)211 { 212 if(!carrier->isTarget( *it))210 for(CollectiblePickup* pickup : this->pickups_) 211 { 212 if(!carrier->isTarget(pickup)) 213 213 return false; 214 214 } … … 227 227 bool PickupCollection::addPickupable(CollectiblePickup* pickup) 228 228 { 229 if(pickup == NULL)229 if(pickup == nullptr) 230 230 return false; 231 231 … … 247 247 { 248 248 if(this->pickups_.size() >= index) 249 return NULL;249 return nullptr; 250 250 251 251 std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); -
code/trunk/src/modules/pickup/PickupCollection.h
r9667 r11071 73 73 virtual ~PickupCollection(); //!< Destructor. 74 74 75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Creates an instance of this Class through XML.75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates an instance of this Class through XML. 76 76 77 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.78 virtual void changedCarrier(void) ; //!< Is called when the pickup has changed its PickupCarrier.79 virtual void changedPickedUp(void) ; //!< Is called when the pickup has transited from picked up to dropped or the other way around.77 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 78 virtual void changedCarrier(void) override; //!< Is called when the pickup has changed its PickupCarrier. 79 virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around. 80 80 81 virtual bool isTarget(const PickupCarrier* carrier) const ; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.81 virtual bool isTarget(const PickupCarrier* carrier) const override; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 82 82 83 83 inline void setRepresentationName(const std::string& name) 84 84 { this->representationName_ = name; } 85 virtual const std::string& getRepresentationName() const 85 virtual const std::string& getRepresentationName() const override 86 86 { return this->representationName_; } 87 87 … … 98 98 99 99 protected: 100 virtual bool createSpawner(void) ; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.100 virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 101 101 102 102 private: -
code/trunk/src/modules/pickup/PickupManager.cc
r10624 r11071 68 68 Constructor. Registers the PickupManager and creates the default PickupRepresentation. 69 69 */ 70 PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_( NULL)70 PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_(nullptr) 71 71 { 72 72 RegisterObject(PickupManager); … … 85 85 { 86 86 // Destroying the default representation. 87 if(this->defaultRepresentation_ != NULL)87 if(this->defaultRepresentation_ != nullptr) 88 88 this->defaultRepresentation_->destroy(); 89 89 … … 91 91 92 92 // Destroying all the PickupInventoryContainers that are still there. 93 for( std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)94 delete it->second;93 for(const auto& mapEntry : this->pickupInventoryContainers_) 94 delete mapEntry.second; 95 95 this->pickupInventoryContainers_.clear(); 96 96 … … 184 184 CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup); 185 185 // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is. 186 if(collectible != NULL&& collectible->isInCollection())186 if(collectible != nullptr && collectible->isInCollection()) 187 187 return; 188 188 189 189 // Getting clientId of the host this change of the pickup's used status concerns. 190 190 PickupCarrier* carrier = pickup->getCarrier(); 191 while(carrier->getCarrierParent() != NULL)191 while(carrier->getCarrierParent() != nullptr) 192 192 carrier = carrier->getCarrierParent(); 193 193 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 194 if(pawn == NULL)194 if(pawn == nullptr) 195 195 return; 196 196 PlayerInfo* info = pawn->getPlayer(); 197 if(info == NULL)197 if(info == nullptr) 198 198 return; 199 199 unsigned int clientId = info->getClientID(); … … 265 265 CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup); 266 266 // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is. 267 if(collectible != NULL&& collectible->isInCollection())267 if(collectible != nullptr && collectible->isInCollection()) 268 268 return; 269 269 270 270 // Getting clientId of the host this change of the pickup's pickedUp status concerns. 271 271 PickupCarrier* carrier = pickup->getCarrier(); 272 while(carrier->getCarrierParent() != NULL)272 while(carrier->getCarrierParent() != nullptr) 273 273 carrier = carrier->getCarrierParent(); 274 274 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 275 if(pawn == NULL)275 if(pawn == nullptr) 276 276 return; 277 277 PlayerInfo* info = pawn->getFormerPlayer(); 278 if(info == NULL)278 if(info == nullptr) 279 279 return; 280 280 unsigned int clientId = info->getClientID(); … … 399 399 return; 400 400 Pickupable* pickupable = this->pickups_.find(pickup)->second; 401 if(pickupable != NULL)401 if(pickupable != nullptr) 402 402 pickupable->drop(); 403 403 } … … 442 442 return; 443 443 Pickupable* pickupable = this->pickups_.find(pickup)->second; 444 if(pickupable != NULL)444 if(pickupable != nullptr) 445 445 pickupable->setUsed(use); 446 446 } -
code/trunk/src/modules/pickup/PickupManager.h
r10624 r11071 117 117 PickupRepresentation* getRepresentation(const std::string& name); // tolua_export 118 118 119 virtual void pickupChangedUsed(Pickupable* pickup, bool used) ; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state.119 virtual void pickupChangedUsed(Pickupable* pickup, bool used) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state. 120 120 static void pickupChangedUsedNetwork(uint32_t pickup, bool inUse, bool usable, bool unusable); //!< Helper method to react to the change in the used status of a Pickupable. 121 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) ; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state.121 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state. 122 122 static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable. 123 123 … … 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> 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 -
code/trunk/src/modules/pickup/PickupRepresentation.cc
r11052 r11071 52 52 This is primarily for use of the PickupManager in creating a default PickupRepresentation. 53 53 */ 54 PickupRepresentation::PickupRepresentation() : BaseObject( NULL), Synchronisable(NULL), spawnerRepresentation_(NULL)54 PickupRepresentation::PickupRepresentation() : BaseObject(nullptr), Synchronisable(nullptr), spawnerRepresentation_(nullptr) 55 55 { 56 56 RegisterObject(PickupRepresentation); … … 64 64 Default Constructor. Registers the object and initializes its member variables. 65 65 */ 66 PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_( NULL)66 PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_(nullptr) 67 67 { 68 68 RegisterObject(PickupRepresentation); … … 78 78 PickupRepresentation::~PickupRepresentation() 79 79 { 80 if(this->spawnerRepresentation_ != NULL)80 if(this->spawnerRepresentation_ != nullptr) 81 81 this->spawnerRepresentation_->destroy(); 82 82 … … 135 135 StaticEntity* PickupRepresentation::createSpawnerRepresentation(PickupSpawner* spawner) 136 136 { 137 if(this->spawnerRepresentation_ == NULL)137 if(this->spawnerRepresentation_ == nullptr) 138 138 { 139 139 orxout(verbose, context::pickups) << "PickupRepresentation: No spawner representation found." << endl; … … 149 149 this->spawnerRepresentation_->setVisible(true); 150 150 StaticEntity* temp = this->spawnerRepresentation_; 151 this->spawnerRepresentation_ = NULL;151 this->spawnerRepresentation_ = nullptr; 152 152 153 153 return temp; … … 164 164 { 165 165 this->spawnerRepresentation_ = representation; 166 if(this->spawnerRepresentation_ != NULL)166 if(this->spawnerRepresentation_ != nullptr) 167 167 this->spawnerRepresentation_->setVisible(false); 168 168 } -
code/trunk/src/modules/pickup/PickupRepresentation.h
r9667 r11071 98 98 virtual ~PickupRepresentation(); //!< Destructor. 99 99 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a PickupRepresentation object through XML.100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a PickupRepresentation object through XML. 101 101 102 102 /** … … 119 119 @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like. 120 120 @param index The index. 121 @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.121 @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns nullptr. 122 122 */ 123 123 inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index) const 124 { if(index == 0) return this->spawnerRepresentation_; return NULL; }124 { if(index == 0) return this->spawnerRepresentation_; return nullptr; } 125 125 /** 126 126 @brief Get the name of the image representing the pickup in the PickupInventory. … … 129 129 inline const std::string& getInventoryRepresentation(void) const { return this->inventoryRepresentation_; } // tolua_export 130 130 131 virtual void changedName() ;131 virtual void changedName() override; 132 132 133 133 StaticEntity* createSpawnerRepresentation(PickupSpawner* spawner); //!< Create a spawnerRepresentation for a specific PickupSpawner. -
code/trunk/src/modules/pickup/PickupSpawner.cc
r10624 r11071 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 } … … 158 158 159 159 // Iterate trough all Pawns. 160 for( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)160 for(Pawn* pawn : ObjectList<Pawn>()) 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 165 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();166 PickupCarrier* carrier = static_cast<PickupCarrier*>( *it);165 Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition(); 166 PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn); 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_)) 171 this->trigger( *it);171 this->trigger(pawn); 172 172 } 173 173 } … … 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 -
code/trunk/src/modules/pickup/PickupSpawner.h
r9667 r11071 82 82 static PickupSpawner* createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0); 83 83 84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a PickupSpawner through XML.85 virtual void tick(float dt) ; //!< Tick, checks if any Pawn is close enough to trigger.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a PickupSpawner through XML. 85 virtual void tick(float dt) override; //!< Tick, checks if any Pawn is close enough to trigger. 86 86 87 87 /** -
code/trunk/src/modules/pickup/items/BoostPickup.cc
r11052 r11071 106 106 107 107 SpaceShip* ship = this->carrierToSpaceShipHelper(); 108 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.108 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 109 109 this->Pickupable::destroy(); 110 110 … … 128 128 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 129 129 @return 130 A pointer to the SpaceShip, or NULLif the conversion failed.130 A pointer to the SpaceShip, or nullptr if the conversion failed. 131 131 */ 132 132 SpaceShip* BoostPickup::carrierToSpaceShipHelper(void) … … 135 135 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 136 136 137 if(ship == NULL)137 if(ship == nullptr) 138 138 { 139 139 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in BoostPickup." << endl; -
code/trunk/src/modules/pickup/items/BoostPickup.h
r11052 r11071 52 52 virtual ~BoostPickup(); //!< Destructor. 53 53 54 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ; //!< Method for creating a BoostPickup object through XML.54 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a BoostPickup object through XML. 55 55 56 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.56 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 57 57 inline float getBoostRefill() 58 58 { return this->boostRefill_; } -
code/trunk/src/modules/pickup/items/DamageBoostPickup.cc
r9667 r11071 106 106 107 107 SpaceShip* ship = this->carrierToSpaceShipHelper(); 108 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.108 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 109 109 this->Pickupable::destroy(); 110 110 … … 152 152 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 153 153 @return 154 A pointer to the SpaceShip, or NULLif the conversion failed.154 A pointer to the SpaceShip, or nullptr if the conversion failed. 155 155 */ 156 156 SpaceShip* DamageBoostPickup::carrierToSpaceShipHelper(void) … … 159 159 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 160 160 161 if(ship == NULL)161 if(ship == nullptr) 162 162 { 163 163 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DamageBoostPickup." << endl; -
code/trunk/src/modules/pickup/items/DronePickup.cc
r9667 r11071 74 74 { 75 75 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 76 this->setDurationType( pickupDurationType::once);76 this->setDurationType(PickupDurationType::once); 77 77 this->droneTemplate_ = ""; 78 78 } … … 122 122 123 123 Pawn* pawn = this->carrierToPawnHelper(); 124 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.124 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 125 125 this->Pickupable::destroy(); 126 126 … … 131 131 Controller* controller = drone->getController(); 132 132 DroneController* droneController = orxonox_cast<DroneController*>(controller); 133 if(droneController != NULL)133 if(droneController != nullptr) 134 134 { 135 135 droneController->setOwner(pawn); … … 156 156 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 157 157 @return 158 A pointer to the Pawn, or NULLif the conversion failed.158 A pointer to the Pawn, or nullptr if the conversion failed. 159 159 */ 160 160 Pawn* DronePickup::carrierToPawnHelper(void) … … 163 163 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 164 164 165 if(pawn == NULL)165 if(pawn == nullptr) 166 166 { 167 167 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DronePickup." << endl; -
code/trunk/src/modules/pickup/items/HealthPickup.cc
r9667 r11071 77 77 this->health_ = 0.0f; 78 78 this->healthRate_ = 0.0f; 79 this->healthType_ = pickupHealthType::limited;79 this->healthType_ = PickupHealthType::limited; 80 80 this->maxHealthSave_ = 0.0f; 81 81 this->maxHealthOverwrite_ = 0.0f; … … 114 114 { 115 115 Pawn* pawn = this->carrierToPawnHelper(); 116 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.116 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 117 117 this->Pickupable::destroy(); 118 118 … … 127 127 switch(this->getHealthType()) 128 128 { 129 case pickupHealthType::permanent:129 case PickupHealthType::permanent: 130 130 if(pawn->getMaxHealth() < fullHealth) 131 131 pawn->setMaxHealth(fullHealth); 132 case pickupHealthType::limited:132 case PickupHealthType::limited: 133 133 pawn->addHealth(health); 134 134 break; 135 case pickupHealthType::temporary:135 case PickupHealthType::temporary: 136 136 if(pawn->getMaxHealth() > fullHealth) 137 137 { … … 168 168 { 169 169 Pawn* pawn = this->carrierToPawnHelper(); 170 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.170 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 171 171 this->Pickupable::destroy(); 172 172 … … 174 174 switch(this->getHealthType()) 175 175 { 176 case pickupHealthType::permanent:176 case PickupHealthType::permanent: 177 177 health = pawn->getHealth()+this->getHealth(); 178 178 if(pawn->getMaxHealth() < health) 179 179 pawn->setMaxHealth(health); 180 case pickupHealthType::limited:180 case PickupHealthType::limited: 181 181 pawn->addHealth(this->getHealth()); 182 182 break; 183 case pickupHealthType::temporary:183 case PickupHealthType::temporary: 184 184 health = pawn->getHealth()+this->getHealth(); 185 185 if(pawn->getMaxHealth() < health) … … 201 201 else 202 202 { 203 if(this->getHealthType() == pickupHealthType::temporary)203 if(this->getHealthType() == PickupHealthType::temporary) 204 204 { 205 205 PickupCarrier* carrier = this->getCarrier(); 206 206 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 207 207 208 if(pawn == NULL)208 if(pawn == nullptr) 209 209 { 210 210 orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is '" << carrier->getIdentifier()->getName() << "' instead of Pawn." << endl; … … 233 233 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 234 234 @return 235 A pointer to the Pawn, or NULLif the conversion failed.235 A pointer to the Pawn, or nullptr if the conversion failed. 236 236 */ 237 237 Pawn* HealthPickup::carrierToPawnHelper(void) … … 240 240 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 241 241 242 if(pawn == NULL)242 if(pawn == nullptr) 243 243 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl; 244 244 … … 256 256 switch(this->getHealthType()) 257 257 { 258 case pickupHealthType::limited:258 case PickupHealthType::limited: 259 259 return HealthPickup::healthTypeLimited_s; 260 case pickupHealthType::temporary:260 case PickupHealthType::temporary: 261 261 return HealthPickup::healthTypeTemporary_s; 262 case pickupHealthType::permanent:262 case PickupHealthType::permanent: 263 263 return HealthPickup::healthTypePermanent_s; 264 264 default: … … 308 308 { 309 309 if(type == HealthPickup::healthTypeLimited_s) 310 this->setHealthType( pickupHealthType::limited);310 this->setHealthType(PickupHealthType::limited); 311 311 else if(type == HealthPickup::healthTypeTemporary_s) 312 this->setHealthType( pickupHealthType::temporary);312 this->setHealthType(PickupHealthType::temporary); 313 313 else if(type == HealthPickup::healthTypePermanent_s) 314 this->setHealthType( pickupHealthType::permanent);314 this->setHealthType(PickupHealthType::permanent); 315 315 else 316 316 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/trunk/src/modules/pickup/items/HealthPickup.h
r9667 r11071 51 51 @ingroup PickupItems 52 52 */ 53 namespace pickupHealthType53 enum class PickupHealthType 54 54 { 55 enum Value 56 { 57 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 58 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 59 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 60 }; 61 } 55 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 56 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 57 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 58 }; 62 59 63 60 /** … … 115 112 @return Returns the health type as an enum. 116 113 */ 117 inline pickupHealthType::Value getHealthType(void) const114 inline PickupHealthType getHealthType(void) const 118 115 { return this->healthType_; } 119 116 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. … … 127 124 @param type The type of this pickup as an enum. 128 125 */ 129 inline void setHealthType( pickupHealthType::Value type)126 inline void setHealthType(PickupHealthType type) 130 127 { this->healthType_ = type; } 131 128 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. … … 139 136 float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it. 140 137 float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well. 141 pickupHealthType::Value healthType_; //!< The type of the HealthPickup.138 PickupHealthType healthType_; //!< The type of the HealthPickup. 142 139 143 140 //! Strings for the health types. -
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
r9667 r11071 139 139 { 140 140 Pawn* pawn = this->carrierToPawnHelper(); 141 if(pawn == NULL)141 if(pawn == nullptr) 142 142 return false; 143 143 … … 163 163 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 164 164 @return 165 A pointer to the Pawn, or NULLif the conversion failed.165 A pointer to the Pawn, or nullptr if the conversion failed. 166 166 */ 167 167 Pawn* InvisiblePickup::carrierToPawnHelper(void) … … 170 170 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 171 171 172 if(pawn == NULL)172 if(pawn == nullptr) 173 173 { 174 174 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in InvisiblePickup." << endl; -
code/trunk/src/modules/pickup/items/MetaPickup.cc
r9667 r11071 79 79 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 80 80 81 this->setDurationType( pickupDurationType::once);82 this->metaType_ = pickupMetaType::none;81 this->setDurationType(PickupDurationType::once); 82 this->metaType_ = PickupMetaType::none; 83 83 } 84 84 … … 104 104 105 105 // If the MetaPickup transited to used, and the metaType is not none. 106 if(this->isUsed() && this->metaType_ != pickupMetaType::none)106 if(this->isUsed() && this->metaType_ != PickupMetaType::none) 107 107 { 108 108 PickupCarrier* carrier = this->getCarrier(); 109 if(this->getMetaType() != pickupMetaType::none && carrier != NULL)109 if(this->getMetaType() != PickupMetaType::none && carrier != nullptr) 110 110 { 111 111 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 112 if(this->getMetaType() == pickupMetaType::destroyCarrier)112 if(this->getMetaType() == PickupMetaType::destroyCarrier) 113 113 { 114 114 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)120 for(Pickupable* pickup : pickups) 121 121 { 122 Pickupable* pickup = (*it); 123 if(pickup == NULL || pickup == this) 122 if(pickup == nullptr || pickup == this) 124 123 continue; 125 124 126 125 // If the metaType is use, then the Pickupable is set to used. 127 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())126 if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed()) 128 127 { 129 128 pickup->setUsed(true); 130 129 } 131 130 // If the metaType is drop, then the Pickupable is dropped. 132 else if(this->getMetaType() == pickupMetaType::drop)131 else if(this->getMetaType() == PickupMetaType::drop) 133 132 { 134 133 pickup->drop(); 135 134 } 136 135 // If the metaType is destroy, then the Pickupable is destroyed. 137 else if(this->getMetaType() == pickupMetaType::destroy)136 else if(this->getMetaType() == PickupMetaType::destroy) 138 137 { 139 138 pickup->Pickupable::destroy(); … … 155 154 switch(this->getMetaType()) 156 155 { 157 case pickupMetaType::none:156 case PickupMetaType::none: 158 157 return MetaPickup::metaTypeNone_s; 159 case pickupMetaType::use:158 case PickupMetaType::use: 160 159 return MetaPickup::metaTypeUse_s; 161 case pickupMetaType::drop:160 case PickupMetaType::drop: 162 161 return MetaPickup::metaTypeDrop_s; 163 case pickupMetaType::destroy:162 case PickupMetaType::destroy: 164 163 return MetaPickup::metaTypeDestroy_s; 165 case pickupMetaType::destroyCarrier:164 case PickupMetaType::destroyCarrier: 166 165 return MetaPickup::metaTypeDestroyCarrier_s; 167 166 default: … … 180 179 if(type == MetaPickup::metaTypeNone_s) 181 180 { 182 this->setMetaType( pickupMetaType::none);181 this->setMetaType(PickupMetaType::none); 183 182 } 184 183 else if(type == MetaPickup::metaTypeUse_s) 185 184 { 186 this->setMetaType( pickupMetaType::use);185 this->setMetaType(PickupMetaType::use); 187 186 } 188 187 else if(type == MetaPickup::metaTypeDrop_s) 189 188 { 190 this->setMetaType( pickupMetaType::drop);189 this->setMetaType(PickupMetaType::drop); 191 190 } 192 191 else if(type == MetaPickup::metaTypeDestroy_s) 193 192 { 194 this->setMetaType( pickupMetaType::destroy);193 this->setMetaType(PickupMetaType::destroy); 195 194 } 196 195 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 197 196 { 198 this->setMetaType( pickupMetaType::destroyCarrier);197 this->setMetaType(PickupMetaType::destroyCarrier); 199 198 } 200 199 else -
code/trunk/src/modules/pickup/items/MetaPickup.h
r9667 r11071 48 48 @ingroup PickupItems 49 49 */ 50 namespace pickupMetaType50 enum class PickupMetaType 51 51 { 52 enum Value 53 { 54 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 55 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 57 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 58 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 59 }; 60 } 52 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 53 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 54 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 55 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 57 }; 61 58 62 59 /** … … 100 97 @return Returns an enum with the meta type of the MetaPickup. 101 98 */ 102 inline pickupMetaType::Value getMetaType(void) const99 inline PickupMetaType getMetaType(void) const 103 100 { return this->metaType_; } 104 101 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. … … 109 106 @param type The meta type as an enum. 110 107 */ 111 inline void setMetaType( pickupMetaType::Value type)108 inline void setMetaType(PickupMetaType type) 112 109 { this->metaType_ = type; } 113 110 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. … … 116 113 void initialize(void); //!< Initializes the member variables. 117 114 118 pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.115 PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. 119 116 120 117 //! Static strings for the meta types. -
code/trunk/src/modules/pickup/items/MunitionContainer.h
r11052 r11071 53 53 virtual ~MunitionContainer(); 54 54 55 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ;55 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; 56 56 57 57 inline const std::string& getMunitionName() const -
code/trunk/src/modules/pickup/items/MunitionPickup.cc
r11052 r11071 86 86 void MunitionPickup::addMunitionContainer(MunitionContainer* munitionContainer) 87 87 { 88 OrxAssert(munitionContainer != NULL, "The munitionContainer cannot be NULL.");88 OrxAssert(munitionContainer != nullptr, "The munitionContainer cannot be nullptr."); 89 89 this->munitionContainers_.push_back(munitionContainer); 90 90 } … … 93 93 { 94 94 if(this->munitionContainers_.size() >= index) 95 return NULL;95 return nullptr; 96 96 else 97 97 return this->munitionContainers_[index]; … … 108 108 Pawn* pawn = this->carrierToPawnHelper(); 109 109 110 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.110 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 111 111 this->Pickupable::destroy(); 112 112 … … 114 114 if(this->isUsed()) 115 115 { 116 for( std::vector<MunitionContainer*>::iterator it = this->munitionContainers_.begin(); it != this->munitionContainers_.end(); ++it)116 for(MunitionContainer* container : this->munitionContainers_) 117 117 { 118 118 //Get pointer to the appropriate munition 119 SubclassIdentifier<Munition> identifier = (*it)->getMunitionType();119 SubclassIdentifier<Munition> identifier = container->getMunitionType(); 120 120 Munition* munition = pawn->getMunition(&identifier); 121 121 if (munition) 122 122 { 123 123 // Add munition and magzines 124 munition->addMunition( (*it)->getMunitionAmount());125 munition->addMagazines( (*it)->getMagazinesAmount());124 munition->addMunition(container->getMunitionAmount()); 125 munition->addMagazines(container->getMagazinesAmount()); 126 126 } 127 (*it)->destroy();127 container->destroy(); 128 128 } 129 129 // This will destroy the pickp … … 140 140 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 141 141 @return 142 A pointer to the Pawn, or NULLif the conversion failed.142 A pointer to the Pawn, or nullptr if the conversion failed. 143 143 */ 144 144 Pawn* MunitionPickup::carrierToPawnHelper(void) … … 147 147 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 148 148 149 if(pawn == NULL)149 if(pawn == nullptr) 150 150 { 151 151 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in MunitionPickup." << endl; -
code/trunk/src/modules/pickup/items/MunitionPickup.h
r11052 r11071 59 59 virtual ~MunitionPickup(); //!< Destructor. 60 60 61 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ; //!< Method for creating a MunitionPickup object through XML.61 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a MunitionPickup object through XML. 62 62 63 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.63 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 64 64 65 v irtual void addMunitionContainer(MunitionContainer* munitionContainer);65 void addMunitionContainer(MunitionContainer* munitionContainer); 66 66 MunitionContainer* getMunitionContainer(unsigned int index); 67 67 -
code/trunk/src/modules/pickup/items/ShieldPickup.cc
r9667 r11071 99 99 100 100 Pawn* pawn = this->carrierToPawnHelper(); 101 if(pawn == NULL)101 if(pawn == nullptr) 102 102 this->Pickupable::destroy(); 103 103 … … 143 143 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 144 144 @return 145 A pointer to the Pawn, or NULLif the conversion failed.145 A pointer to the Pawn, or nullptr if the conversion failed. 146 146 */ 147 147 Pawn* ShieldPickup::carrierToPawnHelper(void) … … 150 150 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 151 151 152 if(pawn == NULL)152 if(pawn == nullptr) 153 153 { 154 154 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in ShieldPickup." << endl; -
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
r10624 r11071 146 146 { 147 147 Pawn* pawn = this->carrierToPawnHelper(); 148 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.148 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 149 149 { 150 150 this->Pickupable::destroy(); … … 173 173 //TODO: Deploy particle effect. 174 174 Pawn* pawn = this->carrierToPawnHelper(); 175 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.175 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 176 176 return; 177 177 … … 182 182 183 183 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 184 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();184 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 185 185 int size = cameraPositions.size(); 186 186 for(int index = 0; index < size; index++) 187 187 { 188 188 CameraPosition* cameraPos = pawn->getCameraPosition(index); 189 if(cameraPos == NULL)189 if(cameraPos == nullptr) 190 190 continue; 191 191 cameraPos->setPosition(cameraPos->getPosition()/factor); … … 201 201 //TODO: Deploy particle effect. 202 202 Pawn* pawn = this->carrierToPawnHelper(); 203 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.203 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 204 204 return; 205 205 … … 208 208 209 209 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 210 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();210 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 211 211 int size = cameraPositions.size(); 212 212 for(int index = 0; index < size; index++) 213 213 { 214 214 CameraPosition* cameraPos = pawn->getCameraPosition(index); 215 if(cameraPos == NULL)215 if(cameraPos == nullptr) 216 216 continue; 217 217 cameraPos->setPosition(cameraPos->getPosition()/this->shrinkFactor_); … … 237 237 { 238 238 Pawn* pawn = this->carrierToPawnHelper(); 239 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.239 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 240 240 { 241 241 this->Pickupable::destroy(); … … 263 263 264 264 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 265 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();265 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 266 266 int size = cameraPositions.size(); 267 267 for(int index = 0; index < size; index++) 268 268 { 269 269 CameraPosition* cameraPos = pawn->getCameraPosition(index); 270 if(cameraPos == NULL)270 if(cameraPos == nullptr) 271 271 continue; 272 272 cameraPos->setPosition(cameraPos->getPosition()/factor); … … 277 277 { 278 278 Pawn* pawn = this->carrierToPawnHelper(); 279 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.279 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 280 280 this->Pickupable::destroy(); 281 281 … … 304 304 305 305 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 306 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();306 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 307 307 int size = cameraPositions.size(); 308 308 for(int index = 0; index < size; index++) 309 309 { 310 310 CameraPosition* cameraPos = pawn->getCameraPosition(index); 311 if(cameraPos == NULL)311 if(cameraPos == nullptr) 312 312 continue; 313 313 cameraPos->setPosition(cameraPos->getPosition()/factor); -
code/trunk/src/modules/pickup/items/SpeedPickup.cc
r9667 r11071 99 99 100 100 SpaceShip* ship = this->carrierToSpaceShipHelper(); 101 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.101 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 102 102 this->Pickupable::destroy(); 103 103 … … 143 143 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 144 144 @return 145 A pointer to the SpaceShip, or NULLif the conversion failed.145 A pointer to the SpaceShip, or nullptr if the conversion failed. 146 146 */ 147 147 SpaceShip* SpeedPickup::carrierToSpaceShipHelper(void) … … 150 150 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 151 151 152 if(ship == NULL)152 if(ship == nullptr) 153 153 { 154 154 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in SpeedPickup." << endl;
Note: See TracChangeset
for help on using the changeset viewer.