Changeset 11071 for code/trunk/src/orxonox/items/ShipPart.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/items/ShipPart.cc
r11052 r11071 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]; 182 182 } 183 183 184 void ShipPart::setDamageAbsorption(float value)185 {186 this->damageAbsorption_ = value;187 }188 189 184 void ShipPart::setParent(ModularSpaceShip* ship) 190 185 { 191 186 this->parent_ = ship; 192 }193 194 /**195 @brief196 Sets the health of the ShipPart.197 */198 void ShipPart::setHealth(float health)199 {200 this->health_ = health;201 187 } 202 188
Note: See TracChangeset
for help on using the changeset viewer.