Changeset 10624 for code/trunk/src/modules/tetris
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/modules/tetris/CMakeLists.txt
r9348 r10624 8 8 9 9 ORXONOX_ADD_LIBRARY(tetris 10 MODULE10 PLUGIN 11 11 FIND_HEADER_FILES 12 12 LINK_LIBRARIES -
code/trunk/src/modules/tetris/Tetris.cc
r9834 r10624 104 104 } 105 105 106 for (std::list<S martPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)106 for (std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 107 107 (*it)->destroy(); 108 108 this->stones_.clear(); … … 136 136 return false; 137 137 138 for(std::list<S martPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)138 for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 139 139 { 140 140 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone … … 192 192 193 193 // check for collisions with all stones 194 for(std::list<S martPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)194 for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 195 195 { 196 196 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); … … 469 469 { 470 470 stonesPerRow = 0; 471 for(std::list<S martPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )472 { 473 std::list<S martPtr<TetrisStone> >::iterator it_temp = it++;471 for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 472 { 473 std::list<StrongPtr<TetrisStone> >::iterator it_temp = it++; 474 474 correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize()); 475 475 if(correctPosition == row) … … 491 491 void Tetris::clearRow(unsigned int row) 492 492 {// clear the full row 493 for(std::list<S martPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )493 for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 494 494 { 495 495 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row) … … 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<S martPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)504 for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 505 505 { 506 506 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row) -
code/trunk/src/modules/tetris/Tetris.h
r10622 r10624 69 69 70 70 PlayerInfo* getPlayer(void) const; //!< Get the player. 71 WeakPtr<TetrisCenterpoint>getCenterpoint(void)71 TetrisCenterpoint* getCenterpoint(void) 72 72 { return this->center_; } 73 73 … … 93 93 94 94 WeakPtr<TetrisCenterpoint> center_; //!< The playing field. 95 std::list<S martPtr<TetrisStone> > stones_; //!< A list of all stones in play.95 std::list<StrongPtr<TetrisStone> > stones_; //!< A list of all stones in play. 96 96 WeakPtr<TetrisBrick> activeBrick_; 97 97 WeakPtr<TetrisBrick> futureBrick_; -
code/trunk/src/modules/tetris/TetrisBrick.cc
r10262 r10624 169 169 if (this->getGametype() != NULL && this->getGametype()->isA(Class(Tetris))) 170 170 { 171 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype() .get());171 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype()); 172 172 return tetrisGametype; 173 173 } -
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
r9667 r10624 80 80 /** 81 81 @brief 82 Is called when the gametype has changed.83 */84 void TetrisCenterpoint::changedGametype()85 {86 SUPER(TetrisCenterpoint, changedGametype);87 88 // Check, whether it's still Tetris.89 this->checkGametype();90 }91 92 /**93 @brief94 82 Checks whether the gametype is Tetris and if it is, sets its centerpoint. 95 83 */ … … 98 86 if (this->getGametype() != NULL && this->getGametype()->isA(Class(Tetris))) 99 87 { 100 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype() .get());88 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype()); 101 89 tetrisGametype->setCenterpoint(this); 102 90 } -
code/trunk/src/modules/tetris/TetrisCenterpoint.h
r9667 r10624 64 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML. 65 65 66 virtual void changedGametype(); //!< Is called when the gametype has changed.67 68 66 /** 69 67 @brief Set the width of the playing field. -
code/trunk/src/modules/tetris/TetrisScore.cc
r10262 r10624 118 118 119 119 if (this->getOwner() != NULL && this->getOwner()->getGametype()) 120 this->owner_ = orxonox_cast<Tetris*>(this->getOwner()->getGametype() .get());120 this->owner_ = orxonox_cast<Tetris*>(this->getOwner()->getGametype()); 121 121 else 122 122 this->owner_ = 0;
Note: See TracChangeset
for help on using the changeset viewer.