- Timestamp:
- May 26, 2011, 10:03:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spacerace/src/modules/gametypes/SpaceRace.cc
r8573 r8616 42 42 { 43 43 RegisterObject(SpaceRace); 44 this-> checkpointsReached_ = 0;44 this->bCheckpointsReached_ = 0; 45 45 this->bTimeIsUp_ = false; 46 46 this->numberOfBots_ = 0; … … 55 55 { 56 56 Gametype::end(); 57 this->stopTimer();58 57 if (this->bTimeIsUp_) { 59 COUT(0) << "Time is up" << std::endl; 60 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage("Time is up"); 58 this->clock_->capture(); 59 int s = this->clock_->getSeconds(); 60 int ms = this->clock_->getMilliseconds()-1000*s; 61 const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n" 62 + "You didn't reach the check point" + multi_cast<std::string>(this->bCheckpointsReached_+1) 63 + " before the time limit. You loose!\n"; 64 COUT(0) << message; 65 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 66 Host::Broadcast(message); 61 67 } 62 68 else { … … 64 70 int s = this->clock_->getSeconds(); 65 71 int ms = this->clock_->getMilliseconds()-1000*s; 66 const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +67 "." + multi_cast<std::string>(ms) + " seconds.";72 const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s) 73 + "." + multi_cast<std::string>(ms) + " seconds.\n"; 68 74 COUT(0) << message << std::endl; 69 75 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); … … 81 87 Gametype::start(); 82 88 83 this->startTimer();84 89 clock_= new Clock(); 85 90 std::string message("The match has started! Reach the check points as quickly as possible!"); … … 90 95 void SpaceRace::newCheckpointReached() 91 96 { 92 this-> checkpointsReached_++;97 this->bCheckpointsReached_++; 93 98 this->clock_->capture(); 94 99 int s = this->clock_->getSeconds(); … … 96 101 const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached()) 97 102 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 98 + " seconds. ";103 + " seconds.\n"; 99 104 COUT(0) << message << std::endl; 100 105 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
Note: See TracChangeset
for help on using the changeset viewer.