- Timestamp:
- Nov 21, 2015, 7:05:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
r10768 r10821 154 154 { 155 155 std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation) 156 for ( unsigned int i = 0; i < allCheckpoints.size(); i++)157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoint s[i],0));156 for (auto & allCheckpoint : allCheckpoints) 157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoint,0)); 159 159 } 160 160 int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler); 161 161 162 162 std::vector<RaceCheckPoint*> returnVec; 163 for ( std::map<RaceCheckPoint*, int>::iterator iter = zaehler.begin(); iter != zaehler.end(); iter++)164 { 165 if ( iter->second == maxWays)166 { 167 returnVec.push_back( iter->first);163 for (auto & elem : zaehler) 164 { 165 if (elem.second == maxWays) 166 { 167 returnVec.push_back(elem.first); 168 168 } 169 169 } … … 226 226 227 227 // find the next checkpoint with the minimal distance 228 for ( std::set<int>::iterator it = raceCheckpoint->getNextCheckpoints().begin(); it != raceCheckpoint->getNextCheckpoints().end(); ++it)229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint( *it);228 for (auto elem : raceCheckpoint->getNextCheckpoints()) 229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(elem); 231 231 float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition()); 232 232 … … 289 289 RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const 290 290 { 291 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)292 if ( this->checkpoints_[i]->getCheckpointIndex() == index)293 return this->checkpoints_[i];291 for (auto & elem : this->checkpoints_) 292 if (elem->getCheckpointIndex() == index) 293 return elem; 294 294 return nullptr; 295 295 } … … 414 414 btScalar radiusObject; 415 415 416 for ( std::vector<StaticEntity*>::const_iterator it = allObjects.begin(); it != allObjects.end(); ++it)417 { 418 for (int everyShape=0; ( *it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)419 { 420 btCollisionShape* currentShape = ( *it)->getAttachedCollisionShape(everyShape)->getCollisionShape();416 for (const auto & allObject : allObjects) 417 { 418 for (int everyShape=0; (allObject)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++) 419 { 420 btCollisionShape* currentShape = (allObject)->getAttachedCollisionShape(everyShape)->getCollisionShape(); 421 421 if(currentShape == nullptr) 422 422 continue;
Note: See TracChangeset
for help on using the changeset viewer.