- Timestamp:
- May 4, 2009, 4:34:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gametypes/src/orxonox/objects/gametypes/Gametype.cc
r2826 r2952 93 93 if (!this->gtinfo_.bStarted_) 94 94 this->checkStart(); 95 else 95 else if (!this->gtinfo_.bEnded_) 96 96 this->spawnDeadPlayersIfRequested(); 97 97 … … 111 111 { 112 112 this->gtinfo_.bEnded_ = true; 113 114 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 115 { 116 if (it->first->getControllableEntity()) 117 { 118 ControllableEntity* oldentity = it->first->getControllableEntity(); 119 120 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getCreator()); 121 if (oldentity->getCamera()) 122 { 123 entity->setPosition(oldentity->getCamera()->getWorldPosition()); 124 entity->setOrientation(oldentity->getCamera()->getWorldOrientation()); 125 } 126 else 127 { 128 entity->setPosition(oldentity->getWorldPosition()); 129 entity->setOrientation(oldentity->getWorldOrientation()); 130 } 131 132 it->first->stopControl(oldentity, true); 133 it->first->startControl(entity); 134 } 135 else 136 this->spawnPlayerAsDefaultPawn(it->first); 137 } 113 138 } 114 139 … … 254 279 if (!it->first->isReadyToSpawn() || !this->gtinfo_.bStarted_) 255 280 { 256 SpawnPoint* spawn = this->getBestSpawnPoint(it->first); 257 if (spawn) 258 { 259 // force spawn at spawnpoint with default pawn 260 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn); 261 spawn->spawn(entity); 262 it->first->startControl(entity); 263 it->second.state_ = PlayerState::Dead; 264 } 265 else 266 { 267 COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl; 268 abort(); 269 } 281 this->spawnPlayerAsDefaultPawn(it->first); 282 it->second.state_ = PlayerState::Dead; 270 283 } 271 284 } … … 345 358 } 346 359 360 void Gametype::spawnPlayerAsDefaultPawn(PlayerInfo* player) 361 { 362 SpawnPoint* spawn = this->getBestSpawnPoint(player); 363 if (spawn) 364 { 365 // force spawn at spawnpoint with default pawn 366 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn); 367 spawn->spawn(entity); 368 player->startControl(entity); 369 } 370 else 371 { 372 COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl; 373 abort(); 374 } 375 } 376 347 377 void Gametype::addBots(unsigned int amount) 348 378 {
Note: See TracChangeset
for help on using the changeset viewer.