Changeset 8767 for code/trunk/src/modules/gametypes/SpaceRace.cc
- Timestamp:
- Jul 20, 2011, 11:27:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/SpaceRace.cc
r8706 r8767 31 31 #include "core/CoreIncludes.h" 32 32 #include "network/Host.h" 33 #include <util/Clock.h>34 #include <util/Math.h>35 33 #include "util/Convert.h" 34 #include "util/Math.h" 36 35 37 36 namespace orxonox 38 37 { 39 38 CreateUnloadableFactory(SpaceRace); 40 39 41 40 SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator) 42 41 { 43 42 RegisterObject(SpaceRace); 44 this-> bCheckpointsReached_ = 0;43 this->checkpointsReached_ = 0; 45 44 this->bTimeIsUp_ = false; 46 45 this->numberOfBots_ = 0; 47 46 } 48 47 49 48 void SpaceRace::end() 50 49 { 51 50 this->Gametype::end(); 52 51 53 52 if (this->bTimeIsUp_) 54 53 { … … 57 56 int ms = this->clock_.getMilliseconds()-1000*s; 58 57 const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n" 59 + "You didn't reach the check point " + multi_cast<std::string>(this-> bCheckpointsReached_+1)58 + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1) 60 59 + " before the time limit. You lose!"; 61 60 COUT(3) << message; 62 61 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 63 Host::Broadcast(message);64 62 } 65 63 else … … 72 70 COUT(3) << message << std::endl; 73 71 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 74 Host::Broadcast(message);75 72 float time = this->clock_.getSecondsPrecise(); 76 73 this->scores_.insert(time); … … 87 84 std::string message("The match has started! Reach the check points as quickly as possible!"); 88 85 COUT(3) << message << std::endl; 89 Host::Broadcast(message);86 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 90 87 } 91 88 92 89 void SpaceRace::newCheckpointReached() 93 90 { 94 this-> bCheckpointsReached_++;91 this->checkpointsReached_++; 95 92 this->clock_.capture(); 96 93 int s = this->clock_.getSeconds(); … … 101 98 COUT(3) << message; 102 99 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 103 Host::Broadcast(message);104 100 } 105 101
Note: See TracChangeset
for help on using the changeset viewer.