Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2018, 4:24:48 PM (6 years ago)
Author:
arismu
Message:

updated endthe
Game

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc

    r11965 r11977  
    107107        return returnVec;
    108108    }
    109 
     109    void SpaceRaceController::endtheGame() const {
     110        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype());
     111        assert(gametype);
     112        if (!gametype)
     113        return;
     114        gametype->end();
     115
     116    }
    110117    /*
    111118     * called from 'findStaticCheckpoints'
     
    179186
    180187        }
    181         if(minNextRaceCheckPoint == nullptr) orxout()<<"nullptr found @181 SpaceRaceController" << endl;
     188        if(minNextRaceCheckPoint == nullptr) {endtheGame(); orxout()<<"nullptr found @181 SpaceRaceController" << endl;}
    182189        return minNextRaceCheckPoint;
    183190    }
     
    233240    }
    234241
     242
     243
     244
     245   
     246
    235247    RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
    236248    {
     249        RaceCheckPoint* res = nullptr;
    237250        for (RaceCheckPoint* checkpoint : this->checkpoints_){
    238251            //conclusion: index=20 is not
    239252            if (checkpoint->getCheckpointIndex() == index){
    240                 if(checkpoint == nullptr) orxout()<<"returned nullptr @line 234 SpaceRaceController"<<endl;
    241                 return checkpoint;
    242             }
    243         }
    244 
    245         return nullptr;
    246     }
     253                //if(checkpoint == nullptr) orxout()<<"returned nullptr @line 234 SpaceRaceController"<<endl;
     254                orxout()<< "index of the checkpoint "<< index <<endl;
     255                res = checkpoint;
     256                return res;
     257            }
     258        }
     259     if(index>2 )   
     260        this->endtheGame();
     261
     262        return res;
     263    }
     264   
     265
    247266
    248267    /*RaceCheckPoint* SpaceRaceController::addVirtualCheckPoint( RaceCheckPoint* previousCheckpoint, int indexFollowingCheckPoint , const Vector3& virtualCheckPointPosition )
     
    299318    void SpaceRaceController::tick(float dt)
    300319    {
     320       
     321
    301322        if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr )
    302323        {
     
    361382        // }
    362383
     384       
    363385        this->moveToPosition(nextRaceCheckpoint_->getPosition());
    364386
Note: See TracChangeset for help on using the changeset viewer.