Changeset 10821 for code/branches/cpp11_v2/src/modules/pong
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/pong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/pong/Pong.cc
r10768 r10821 145 145 146 146 // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint. 147 for ( size_t i = 0; i < 2; ++i)147 for (auto & elem : this->bat_) 148 148 { 149 if ( this->bat_[i]== nullptr)149 if (elem == nullptr) 150 150 { 151 this->bat_[i]= new PongBat(this->center_->getContext());152 this->bat_[i]->addTemplate(this->center_->getBattemplate());151 elem = new PongBat(this->center_->getContext()); 152 elem->addTemplate(this->center_->getBattemplate()); 153 153 } 154 154 } … … 211 211 { 212 212 // first spawn human players to assign always the left bat to the player in singleplayer 213 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)214 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))215 this->spawnPlayer( it->first);213 for (auto & elem : this->players_) 214 if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 215 this->spawnPlayer(elem.first); 216 216 // now spawn bots 217 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)218 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))219 this->spawnPlayer( it->first);217 for (auto & elem : this->players_) 218 if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 219 this->spawnPlayer(elem.first); 220 220 } 221 221 -
code/branches/cpp11_v2/src/modules/pong/PongAI.cc
r10769 r10821 77 77 PongAI::~PongAI() 78 78 { 79 for ( std::list<std::pair<Timer*, char>>::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)80 it->first->destroy();79 for (auto & elem : this->reactionTimers_) 80 elem.first->destroy(); 81 81 } 82 82
Note: See TracChangeset
for help on using the changeset viewer.