Changeset 11054 for code/branches/cpp11_v3/src/orxonox/items
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/orxonox/items/Engine.cc
r9667 r11054 50 50 RegisterObject(Engine); 51 51 52 this->ship_ = 0;52 this->ship_ = nullptr; 53 53 this->shipID_ = OBJECTID_UNKNOWN; 54 54 this->relativePosition_ = Vector3::ZERO; … … 136 136 void Engine::networkcallback_shipID() 137 137 { 138 this->ship_ = 0;138 this->ship_ = nullptr; 139 139 140 140 if (this->shipID_ != OBJECTID_UNKNOWN) … … 155 155 void Engine::run(float dt) 156 156 { 157 if (this->ship_ == NULL)157 if (this->ship_ == nullptr) 158 158 { 159 159 if (this->shipID_ != 0) … … 161 161 this->networkcallback_shipID(); 162 162 163 if (this->ship_ == NULL)163 if (this->ship_ == nullptr) 164 164 return; 165 165 } -
code/branches/cpp11_v3/src/orxonox/items/Engine.h
r9667 r11054 59 59 virtual ~Engine(); 60 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 62 62 void setConfigValues(); 63 63 … … 67 67 /** 68 68 @brief Get the SpaceShip this Engine is mounted on. 69 @return Returns a pointer to the SpaceShip. NULLif it isn't mounted on any ship.69 @return Returns a pointer to the SpaceShip. nullptr if it isn't mounted on any ship. 70 70 */ 71 71 inline SpaceShip* getShip() const -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc
r9939 r11054 67 67 else 68 68 { 69 this->defEngineSndBoost_ = 0;70 this->defEngineSndNormal_ = 0;71 this->lua_ = 0;69 this->defEngineSndBoost_ = nullptr; 70 this->defEngineSndNormal_ = nullptr; 71 this->lua_ = nullptr; 72 72 } 73 73 this->state_ = 0; … … 85 85 { 86 86 // We have no ship, so the effects are not attached and won't be destroyed automatically 87 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)88 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)89 (*it 2)->destroy();87 for (EffectContainer* container : this->effectContainers_) 88 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it) 89 (*it)->destroy(); 90 90 if (this->defEngineSndNormal_) 91 91 this->defEngineSndNormal_->destroy(); … … 178 178 179 179 // Update all effect conditions 180 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)181 (*it)->updateCondition();180 for (EffectContainer* container : this->effectContainers_) 181 container->updateCondition(); 182 182 } 183 183 } … … 198 198 this->getShip()->attach(defEngineSndBoost_); 199 199 200 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)201 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsEnd(); ++it2)202 this->getShip()->attach(*it 2);200 for (EffectContainer* container : this->effectContainers_) 201 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it) 202 this->getShip()->attach(*it); 203 203 } 204 204 205 205 void MultiStateEngine::addEffectContainer(EffectContainer* effect) 206 206 { 207 if (effect == NULL)207 if (effect == nullptr) 208 208 return; 209 209 effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size())); … … 219 219 { 220 220 unsigned int i = 0; 221 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)221 for (EffectContainer* effectContainer : this->effectContainers_) 222 222 { 223 223 if (i == index) 224 return (*it); 225 } 226 return NULL; 224 return effectContainer; 225 i++; 226 } 227 return nullptr; 227 228 } 228 229 -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.h
r9667 r11054 52 52 virtual ~MultiStateEngine(); 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 virtual void run(float dt) ;56 virtual void run(float dt) override; 57 57 58 virtual void addToSpaceShip(SpaceShip* ship) ;58 virtual void addToSpaceShip(SpaceShip* ship) override; 59 59 60 60 void addEffectContainer(EffectContainer* effect); -
code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.h
r10262 r11054 100 100 virtual ~PartDestructionEvent(); 101 101 102 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;102 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 103 103 104 104 void execute(); -
code/branches/cpp11_v3/src/orxonox/items/ShipPart.cc
r11052 r11054 49 49 50 50 ShipPart::ShipPart(Context* context) 51 : Item(context), parent_( NULL)51 : Item(context), parent_(nullptr) 52 52 { 53 53 RegisterObject(ShipPart); … … 121 121 void ShipPart::addEntity(StaticEntity* entity) 122 122 { 123 OrxAssert(entity != NULL, "The Entity cannot be NULL.");123 OrxAssert(entity != nullptr, "The Entity cannot be nullptr."); 124 124 this->entityList_.push_back(entity); 125 125 } … … 129 129 Get the i-th StaticEntity of the ShipPart. 130 130 @return 131 Returns a pointer to the i-the StaticEntity. NULLif there is no StaticEntity with that index.131 Returns a pointer to the i-the StaticEntity. nullptr if there is no StaticEntity with that index. 132 132 */ 133 133 StaticEntity* ShipPart::getEntity(unsigned int index) 134 134 { 135 135 if(this->entityList_.size() >= index) 136 return NULL;136 return nullptr; 137 137 else 138 138 return this->entityList_[index]; … … 142 142 @brief 143 143 Check whether the ShipPart has a particular Entity. 144 @param engine144 @param search 145 145 A pointer to the Entity to be checked. 146 146 */ 147 bool ShipPart::hasEntity(StaticEntity* entity) const148 { 149 for( unsigned int i = 0; i < this->entityList_.size(); i++)150 { 151 if( this->entityList_[i] == entity)147 bool ShipPart::hasEntity(StaticEntity* search) const 148 { 149 for(StaticEntity* entity : this->entityList_) 150 { 151 if(entity == search) 152 152 return true; 153 153 } … … 163 163 void ShipPart::addDestructionEvent(PartDestructionEvent* event) 164 164 { 165 OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL.");165 OrxAssert(event != nullptr, "The PartDestructionEvent cannot be nullptr."); 166 166 event->setParent(this); 167 167 this->eventList_.push_back(event); … … 172 172 Get the i-th PartDestructionEvent of the ShipPart. 173 173 @return 174 Returns a pointer to the i-the PartDestructionEvent. NULLif there is no PartDestructionEvent with that index.174 Returns a pointer to the i-the PartDestructionEvent. nullptr if there is no PartDestructionEvent with that index. 175 175 */ 176 176 PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index) 177 177 { 178 178 if(this->eventList_.size() <= index) 179 return NULL;179 return nullptr; 180 180 else 181 181 return this->eventList_[index]; -
code/branches/cpp11_v3/src/orxonox/items/ShipPart.h
r10624 r11054 47 47 virtual ~ShipPart(); 48 48 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 50 50 51 51 virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
Note: See TracChangeset
for help on using the changeset viewer.