Changeset 10821 for code/branches/cpp11_v2/src/modules/tetris
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/tetris
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/tetris/Tetris.cc
r10769 r10821 104 104 } 105 105 106 for ( std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)107 ( *it)->destroy();106 for (auto & elem : this->stones_) 107 (elem)->destroy(); 108 108 this->stones_.clear(); 109 109 } … … 341 341 { 342 342 // Spawn a human player. 343 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)344 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))345 this->spawnPlayer( it->first);343 for (auto & elem : this->players_) 344 if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 345 this->spawnPlayer(elem.first); 346 346 } 347 347 … … 502 502 } 503 503 // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug. 504 for( std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)505 { 506 if(static_cast<unsigned int>((( *it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)507 ( *it)->setPosition((*it)->getPosition()-Vector3(0,10,0));504 for(auto & elem : this->stones_) 505 { 506 if(static_cast<unsigned int>(((elem)->getPosition().y - 5)/this->center_->getStoneSize()) > row) 507 (elem)->setPosition((elem)->getPosition()-Vector3(0,10,0)); 508 508 } 509 509 -
code/branches/cpp11_v2/src/modules/tetris/TetrisBrick.cc
r10765 r10821 239 239 { 240 240 assert(this->tetris_); 241 for( unsigned int i = 0; i < this->brickStones_.size(); i++)242 { 243 this->brickStones_[i]->detachFromParent();244 this->brickStones_[i]->attachToParent(center);245 this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));241 for(auto & elem : this->brickStones_) 242 { 243 elem->detachFromParent(); 244 elem->attachToParent(center); 245 elem->setPosition(this->getPosition()+this->tetris_->rotateVector(elem->getPosition(),this->rotationCount_ )); 246 246 } 247 247 this->brickStones_.clear();
Note: See TracChangeset
for help on using the changeset viewer.