Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9323 for code/branches


Ignore:
Timestamp:
Jul 21, 2012, 6:32:02 PM (12 years ago)
Author:
landauf
Message:

replaced tabs with spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/modules/tetris/Tetris.cc

    r9322 r9323  
    108108        if((this->activeBrick_ != NULL)&&(!this->hasEnded()))
    109109        {
    110                 this->endGameCriteria_ += dt;
     110            this->endGameCriteria_ += dt;
    111111            if(!this->isValidBrickPosition(this->activeBrick_, this->activeBrick_->getPosition()))
    112112            {
     
    160160            Vector3 stonePosition; //the current stone's offset to position
    161161            if(isRotation)
    162                 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()+1);
     162                stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()+1);
    163163            else
    164164                stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount());
     
    204204                float y_offset = static_cast<int>((this->activeBrick_->getPosition().y-currentStonePosition.y+10)/10)*10 + currentStonePosition.y;
    205205                if(y_offset < 0) //filter out extreme cases (very rare bug)
    206                         y_offset = 0;
     206                    y_offset = 0;
    207207                this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, y_offset, this->activeBrick_->getPosition().z));
    208208                return false;
     
    213213        if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
    214214        {
    215                 float yOffset = stone->getPosition().y + this->center_->getStoneSize()/2.0f;//calculate offset
    216                 if(yOffset < 0) //catch brake-throughs
    217                     yOffset = 0;
    218                 this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, yOffset, this->activeBrick_->getPosition().z));
     215            float yOffset = stone->getPosition().y + this->center_->getStoneSize()/2.0f;//calculate offset
     216            if(yOffset < 0) //catch brake-throughs
     217                yOffset = 0;
     218            this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, yOffset, this->activeBrick_->getPosition().z));
    219219            return false;
    220220        }
     
    246246    Vector3 Tetris::rotateVector(Vector3 position, unsigned int amount)
    247247    {
    248         float temp = 0;
     248        float temp = 0;
    249249        for(unsigned int i = 0; i < amount; i++)
    250250        {
     
    421421    void Tetris::findFullRows()
    422422    {
    423         unsigned int correctPosition = 0;
    424         unsigned int stonesPerRow = 0;
    425         for (unsigned int row = 0; row < this->center_->getHeight(); row++)
    426         {
    427             stonesPerRow = 0;
     423        unsigned int correctPosition = 0;
     424        unsigned int stonesPerRow = 0;
     425        for (unsigned int row = 0; row < this->center_->getHeight(); row++)
     426        {
     427            stonesPerRow = 0;
    428428            for(std::vector<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    429429            {
    430                 correctPosition = static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize());
     430                correctPosition = static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize());
    431431                if(correctPosition == row)
    432432                {
     
    450450        {
    451451            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
    452                 (*it)->setPosition(Vector3(-50,-50,100));
    453                 //{(*it)->destroy(); this->stones_.erase(it); orxout()<< "destroy row "<<endl;}//experimental
     452                (*it)->setPosition(Vector3(-50,-50,100));
     453                //{(*it)->destroy(); this->stones_.erase(it); orxout()<< "destroy row "<<endl;}//experimental
    454454        }
    455455      // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
Note: See TracChangeset for help on using the changeset viewer.