Changeset 8661 for code/branches/presentation/src
- Timestamp:
- May 29, 2011, 5:01:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/tetris/Tetris.cc
r8645 r8661 127 127 assert(stone); 128 128 129 if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level 130 { 131 stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->getPosition().z)); 132 return false; 133 } 134 135 for(std::vector<TetrisStone*>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 129 // we use a reverse iterator because we have to check for collisions with the topmost stones first 130 for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it) 136 131 { 137 132 if(stone == *it) … … 145 140 return false; 146 141 }// This case applies if the stones overlap partially vertically 142 } 143 144 // after we checked for collision with all stones, we also check for collision with the bottom 145 if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level 146 { 147 stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->getPosition().z)); 148 return false; 147 149 } 148 150
Note: See TracChangeset
for help on using the changeset viewer.