Changeset 5806 for code/branches/core5/src/orxonox/gametypes/Gametype.cc
- Timestamp:
- Sep 27, 2009, 4:13:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/orxonox/gametypes/Gametype.cc
r5801 r5806 47 47 CreateUnloadableFactory(Gametype); 48 48 49 Gametype::Gametype(BaseObject* creator) : BaseObject(creator) , gtinfo_(creator)49 Gametype::Gametype(BaseObject* creator) : BaseObject(creator) 50 50 { 51 51 RegisterObject(Gametype); 52 53 this->setGametype(this); 52 53 this->gtinfo_ = new GametypeInfo(creator); 54 55 this->setGametype(SmartPtr<Gametype>(this, false)); 54 56 55 57 this->defaultControllableEntity_ = Class(Spectator); … … 76 78 else 77 79 this->scoreboard_ = 0; 80 } 81 82 Gametype::~Gametype() 83 { 84 if (this->isInitialized()) 85 this->gtinfo_->destroy(); 78 86 } 79 87 … … 100 108 } 101 109 102 if (this->gtinfo_ .bStartCountdownRunning_ && !this->gtinfo_.bStarted_)103 this->gtinfo_ .startCountdown_ -= dt;104 105 if (!this->gtinfo_ .bStarted_)110 if (this->gtinfo_->bStartCountdownRunning_ && !this->gtinfo_->bStarted_) 111 this->gtinfo_->startCountdown_ -= dt; 112 113 if (!this->gtinfo_->bStarted_) 106 114 this->checkStart(); 107 else if (!this->gtinfo_ .bEnded_)115 else if (!this->gtinfo_->bEnded_) 108 116 this->spawnDeadPlayersIfRequested(); 109 117 … … 115 123 this->addBots(this->numberOfBots_); 116 124 117 this->gtinfo_ .bStarted_ = true;125 this->gtinfo_->bStarted_ = true; 118 126 119 127 this->spawnPlayersIfRequested(); … … 122 130 void Gametype::end() 123 131 { 124 this->gtinfo_ .bEnded_ = true;132 this->gtinfo_->bEnded_ = true; 125 133 126 134 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) … … 243 251 244 252 if (killer->getPlayer()->getClientID() != CLIENTID_UNKNOWN) 245 this->gtinfo_ .sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());253 this->gtinfo_->sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID()); 246 254 if (victim->getPlayer()->getClientID() != CLIENTID_UNKNOWN) 247 this->gtinfo_ .sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());255 this->gtinfo_->sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID()); 248 256 } 249 257 } … … 308 316 it->second.state_ = PlayerState::Dead; 309 317 310 if (!it->first->isReadyToSpawn() || !this->gtinfo_ .bStarted_)318 if (!it->first->isReadyToSpawn() || !this->gtinfo_->bStarted_) 311 319 { 312 320 this->spawnPlayerAsDefaultPawn(it->first); … … 319 327 void Gametype::checkStart() 320 328 { 321 if (!this->gtinfo_ .bStarted_)322 { 323 if (this->gtinfo_ .bStartCountdownRunning_)324 { 325 if (this->gtinfo_ .startCountdown_ <= 0)326 { 327 this->gtinfo_ .bStartCountdownRunning_ = false;328 this->gtinfo_ .startCountdown_ = 0;329 if (!this->gtinfo_->bStarted_) 330 { 331 if (this->gtinfo_->bStartCountdownRunning_) 332 { 333 if (this->gtinfo_->startCountdown_ <= 0) 334 { 335 this->gtinfo_->bStartCountdownRunning_ = false; 336 this->gtinfo_->startCountdown_ = 0; 329 337 this->start(); 330 338 } … … 349 357 if (allplayersready && hashumanplayers) 350 358 { 351 this->gtinfo_ .startCountdown_ = this->initialStartCountdown_;352 this->gtinfo_ .bStartCountdownRunning_ = true;359 this->gtinfo_->startCountdown_ = this->initialStartCountdown_; 360 this->gtinfo_->bStartCountdownRunning_ = true; 353 361 } 354 362 }
Note: See TracChangeset
for help on using the changeset viewer.