Changeset 8911
- Timestamp:
- Nov 2, 2011, 1:23:26 PM (13 years ago)
- Location:
- code/branches/spaceraceTwo/src/modules/gametypes
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceraceTwo/src/modules/gametypes/CMakeLists.txt
r8706 r8911 2 2 SpaceRace.cc 3 3 RaceCheckPoint.cc 4 SpaceRaceManager.cc 4 5 ) 5 6 -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc
r8898 r8911 29 29 #include "SpaceRace.h" 30 30 31 #include "items/Engine.h" 32 31 33 #include "core/CoreIncludes.h" 32 34 #include "chat/ChatManager.h" … … 46 48 this->bTimeIsUp_ = false; 47 49 this->numberOfBots_ = 0; 48 50 this->cantMove_=false; 49 51 } 50 52 … … 88 90 89 91 void SpaceRace::start() 90 { int i=0; 91 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 92 {this->maxSpeedBack_[i]=it->getMaxSpeedBack(); 93 this->maxSpeedFront_[i]=it->getMaxSpeedFront(); 94 this->maxSpeedLeftRight_[i]=it->getMaxSpeedLeftRight(); 95 this->maxSpeedUpDown_[i]=(it->getMaxSpeedUpDown()); 96 97 it->setMaxSpeedBack(0); 98 it->setMaxSpeedFront(0); 99 it->setMaxSpeedLeftRight(0); 100 it->setMaxSpeedUpDown(0); 101 102 i++; 103 } 104 //Gametype::start(); 105 this->addBots(this->numberOfBots_); 106 this->spawnPlayersIfRequested(); 107 108 109 Gametype::checkStart(); 110 111 i=0; 112 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 113 { 114 it->setMaxSpeedBack(this->maxSpeedBack_[i]); 115 it->setMaxSpeedFront(this->maxSpeedFront_[i]); 116 it->setMaxSpeedLeftRight(this->maxSpeedLeftRight_[i]); 117 it->setMaxSpeedUpDown(this->maxSpeedUpDown_[i]); 118 i++; 119 92 { 93 this->spawnPlayersIfRequested(); Gametype::checkStart(); 94 this->cantMove_=true; 95 96 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 97 {if(it->getMaxSpeedFront()>0){this->maxSpeedBack_=it->getMaxSpeedBack(); 98 this->maxSpeedFront_=it->getMaxSpeedFront(); 99 this->maxSpeedLeftRight_=it->getMaxSpeedLeftRight(); 100 this->maxSpeedUpDown_=(it->getMaxSpeedUpDown()); 101 } 102 it->setMaxSpeedBack(0); 103 it->setMaxSpeedFront(0); 104 it->setMaxSpeedLeftRight(0); 105 it->setMaxSpeedUpDown(0); 106 107 108 } 109 110 this->addBots(this->numberOfBots_); 111 112 } 113 114 void SpaceRace::tick(float dt){ 115 SUPER(SpaceRace,tick,dt); 116 117 if(!this->isStartCountdownRunning() && this->cantMove_){ 118 119 for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 120 { 121 it->setMaxSpeedBack(this->maxSpeedBack_); 122 it->setMaxSpeedFront(this->maxSpeedFront_); 123 it->setMaxSpeedLeftRight(this->maxSpeedLeftRight_); 124 it->setMaxSpeedUpDown(this->maxSpeedUpDown_); 125 } 126 this->cantMove_= false; 127 128 std::string message("The match has started! Reach the check points as quickly as possible!"); 129 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 130 ChatManager::message(message); 120 131 121 } 122 delete &this->maxSpeedBack_; 123 delete &this->maxSpeedFront_; 124 delete &this->maxSpeedLeftRight_; 125 delete &this->maxSpeedUpDown_; 126 std::string message("The match has started! Reach the check points as quickly as possible!"); 127 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message); 128 ChatManager::message(message); 129 132 } 133 134 130 135 } 131 136 -
code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.h
r8898 r8911 34 34 #include <set> 35 35 #include <string> 36 # include <vector>36 # include <vector> 37 37 38 38 #include <util/Clock.h> … … 69 69 void tick(float dt); 70 70 protected: 71 71 72 72 private: 73 std::vector<float> maxSpeedBack_; std::vector<float> maxSpeedFront_; std::vector<float> maxSpeedLeftRight_; std::vector<float> maxSpeedUpDown_; 73 float maxSpeedBack_; float maxSpeedFront_; float maxSpeedLeftRight_; float maxSpeedUpDown_; 74 bool cantMove_; 74 75 int checkpointsReached_; //The current number of check points reached by the player. 75 76 std::set<float> scores_; //The times of the players are saved in a set.
Note: See TracChangeset
for help on using the changeset viewer.