Changeset 10821 for code/branches/cpp11_v2/src/orxonox/collisionshapes
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10768 r10821 65 65 { 66 66 // Delete all children 67 for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); 68 it != this->attachedShapes_.end(); ++it) 67 for (auto & elem : this->attachedShapes_) 69 68 { 70 69 // make sure that the child doesn't want to detach itself --> speedup because of the missing update 71 it->first->notifyDetached();72 it->first->destroy();73 if (this->collisionShape_ == it->second)70 elem.first->notifyDetached(); 71 elem.first->destroy(); 72 if (this->collisionShape_ == elem.second) 74 73 this->collisionShape_ = nullptr; // don't destroy it twice 75 74 } … … 247 246 { 248 247 unsigned int i = 0; 249 for ( std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)248 for (const auto & elem : this->attachedShapes_) 250 249 { 251 250 if (i == index) 252 return it->first;251 return elem.first; 253 252 ++i; 254 253 } … … 267 266 std::vector<CollisionShape*> shapes; 268 267 // Iterate through all attached CollisionShapes and add them to the list of shapes. 269 for( std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)270 shapes.push_back( it->first);268 for(auto & elem : this->attachedShapes_) 269 shapes.push_back(elem.first); 271 270 272 271 // Delete the compound shape and create a new one. … … 275 274 276 275 // Re-attach all CollisionShapes. 277 for( std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)278 { 279 CollisionShape* shape = *it;276 for(auto shape : shapes) 277 { 278 280 279 shape->setScale3D(this->getScale3D()); 281 280 // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
Note: See TracChangeset
for help on using the changeset viewer.