Changeset 11065 for code/branches/cpp11_v3/src/modules/pickup
- Timestamp:
- Jan 17, 2016, 1:59:00 PM (9 years ago)
- Location:
- code/branches/cpp11_v3/src/modules/pickup/items
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3/src/modules/pickup/items/BoostPickup.cc
r11052 r11065 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/branches/cpp11_v3/src/modules/pickup/items/BoostPickup.h
r11052 r11065 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/branches/cpp11_v3/src/modules/pickup/items/MunitionContainer.h
r11052 r11065 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/branches/cpp11_v3/src/modules/pickup/items/MunitionPickup.cc
r11052 r11065 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/branches/cpp11_v3/src/modules/pickup/items/MunitionPickup.h
r11064 r11065 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 65 void addMunitionContainer(MunitionContainer* munitionContainer);
Note: See TracChangeset
for help on using the changeset viewer.