- 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/SpaceRaceManager.cc
r10768 r10821 54 54 SpaceRaceManager::~SpaceRaceManager() 55 55 { 56 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)57 this->checkpoints_[i]->destroy();56 for (auto & elem : this->checkpoints_) 57 elem->destroy(); 58 58 } 59 59 … … 77 77 } 78 78 79 for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)79 for (auto & elem : players_) 80 80 { 81 81 82 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)82 for (auto & _i : this->checkpoints_) 83 83 { 84 if ( this->checkpoints_[i]->playerWasHere(it->first)){85 this->checkpointReached( this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);84 if (_i->playerWasHere(elem.first)){ 85 this->checkpointReached(_i, elem.first /*this->checkpoints_[i]->getPlayer()*/); 86 86 } 87 87 } … … 113 113 RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const 114 114 { 115 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)116 if ( this->checkpoints_[i]->getCheckpointIndex() == index)117 return this->checkpoints_[i];115 for (auto & elem : this->checkpoints_) 116 if (elem->getCheckpointIndex() == index) 117 return elem; 118 118 return nullptr; 119 119 } … … 125 125 // the player already visited an old checkpoint; see which checkpoints are possible now 126 126 const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints(); 127 for ( std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)128 if (this->findCheckpoint( *it) == newCheckpoint)127 for (const auto & possibleCheckpoint : possibleCheckpoints) 128 if (this->findCheckpoint(possibleCheckpoint) == newCheckpoint) 129 129 return true; 130 130 return false; … … 179 179 { 180 180 const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints(); 181 for ( std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)182 this->findCheckpoint( *it)->setRadarVisibility(false);181 for (const auto & elem : oldVisible) 182 this->findCheckpoint(elem)->setRadarVisibility(false); 183 183 } 184 184 … … 188 188 189 189 const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints(); 190 for ( std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)191 this->findCheckpoint( *it)->setRadarVisibility(true);190 for (const auto & elem : newVisible) 191 this->findCheckpoint(elem)->setRadarVisibility(true); 192 192 } 193 193 }
Note: See TracChangeset
for help on using the changeset viewer.