Changeset 11977 for code/branches/RacingBots_FS18/src/modules
- Timestamp:
- May 17, 2018, 4:24:48 PM (7 years ago)
- Location:
- code/branches/RacingBots_FS18/src/modules/gametypes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc
r11966 r11977 125 125 { 126 126 engine->setActive(false); 127 engine-> setAccelerationFront(100.0f);127 engine->addSpeedMultiply(1.7); 128 128 } 129 129 … … 186 186 void SpaceRace::end() 187 187 { 188 188 189 this->clock_.capture(); 189 190 int s = this->clock_.getSeconds(); 190 191 int ms = static_cast<int>(this->clock_.getMilliseconds() - 1000*s); 191 192 std::string message; 193 message = multi_cast<std::string>(s)+"You could not reach the last checkpoint before your opponents. YOU LOOSE!"; 192 194 193 195 if (this->bTimeIsUp_) … … 196 198 + "You loose!"; 197 199 } 198 else if(this->bLost) 199 message = multi_cast<std::string>(s)+"You could not reach the last checkpoint before your opponents. YOU LOOSE!"; 200 200 201 else 201 202 { … … 203 204 + "." + multi_cast<std::string>(ms) + " seconds."; 204 205 } 206 205 207 if (!this->hasEnded()) 206 208 { -
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.cc
r11965 r11977 107 107 return returnVec; 108 108 } 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 } 110 117 /* 111 118 * called from 'findStaticCheckpoints' … … 179 186 180 187 } 181 if(minNextRaceCheckPoint == nullptr) orxout()<<"nullptr found @181 SpaceRaceController" << endl;188 if(minNextRaceCheckPoint == nullptr) {endtheGame(); orxout()<<"nullptr found @181 SpaceRaceController" << endl;} 182 189 return minNextRaceCheckPoint; 183 190 } … … 233 240 } 234 241 242 243 244 245 246 235 247 RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const 236 248 { 249 RaceCheckPoint* res = nullptr; 237 250 for (RaceCheckPoint* checkpoint : this->checkpoints_){ 238 251 //conclusion: index=20 is not 239 252 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 247 266 248 267 /*RaceCheckPoint* SpaceRaceController::addVirtualCheckPoint( RaceCheckPoint* previousCheckpoint, int indexFollowingCheckPoint , const Vector3& virtualCheckPointPosition ) … … 299 318 void SpaceRaceController::tick(float dt) 300 319 { 320 321 301 322 if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr ) 302 323 { … … 361 382 // } 362 383 384 363 385 this->moveToPosition(nextRaceCheckpoint_->getPosition()); 364 386 -
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRaceController.h
r11964 r11977 58 58 RaceCheckPoint* nextPointFind(RaceCheckPoint*); 59 59 RaceCheckPoint* adjustNextPoint(); 60 void endtheGame() const; 61 60 62 std::vector<RaceCheckPoint*> findStaticCheckpoints(RaceCheckPoint*, const std::vector<RaceCheckPoint*>&); 61 63 std::vector<RaceCheckPoint*> staticCheckpoints();
Note: See TracChangeset
for help on using the changeset viewer.