- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
r10624 r11071 61 61 this->server_overwrite_ = 0; 62 62 this->client_overwrite_ = 0; 63 this->player_ = 0;64 this->formerPlayer_ = NULL;63 this->player_ = nullptr; 64 this->formerPlayer_ = nullptr; 65 65 this->playerID_ = OBJECTID_UNKNOWN; 66 this->hud_ = 0;67 this->camera_ = 0;68 this->xmlcontroller_ = 0;69 //this->controller_ = 0;70 this->reverseCamera_ = 0;66 this->hud_ = nullptr; 67 this->camera_ = nullptr; 68 this->xmlcontroller_ = nullptr; 69 //this->controller_ = nullptr; 70 this->reverseCamera_ = nullptr; 71 71 this->bDestroyWhenPlayerLeft_ = false; 72 72 this->cameraPositionRootNode_ = this->node_->createChildSceneNode(); 73 this->currentCameraPosition_ = 0;73 this->currentCameraPosition_ = nullptr; 74 74 this->bMouseLook_ = false; 75 75 this->mouseLookSpeed_ = 200; … … 108 108 this->camera_->destroy(); 109 109 110 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)111 (*it)->destroy();110 for (CameraPosition* cameraPosition : this->cameraPositions_) 111 cameraPosition->destroy(); 112 112 113 113 if (this->getScene()->getSceneManager()) … … 165 165 { 166 166 unsigned int i = 0; 167 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)167 for (CameraPosition* cameraPosition : this->cameraPositions_) 168 168 { 169 169 if (i == index) 170 return (*it);170 return cameraPosition; 171 171 ++i; 172 172 } 173 return 0;173 return nullptr; 174 174 } 175 175 … … 180 180 181 181 unsigned int counter = 0; 182 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)183 { 184 if ( (*it)== this->currentCameraPosition_)182 for (CameraPosition* cameraPosition : this->cameraPositions_) 183 { 184 if (cameraPosition == this->currentCameraPosition_) 185 185 break; 186 186 counter++; … … 194 194 bool ControllableEntity::setCameraPosition(unsigned int index) 195 195 { 196 if(this->camera_ != NULL&& this->cameraPositions_.size() > 0)196 if(this->camera_ != nullptr && this->cameraPositions_.size() > 0) 197 197 { 198 198 if(index >= this->cameraPositions_.size()) … … 219 219 else if (this->cameraPositions_.size() > 0) 220 220 { 221 for (std::list<StrongPtr<CameraPosition> 221 for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 222 222 { 223 223 if ((*it) == this->camera_->getParent()) … … 241 241 { 242 242 this->camera_->attachToNode(this->cameraPositionRootNode_); 243 this->currentCameraPosition_ = 0;243 this->currentCameraPosition_ = nullptr; 244 244 } 245 245 … … 321 321 if ( !GameMode::isMaster() ) 322 322 { 323 if ( target != 0)323 if ( target != nullptr ) 324 324 { 325 325 callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() ); … … 350 350 this->bHasLocalController_ = player->isLocalPlayer(); 351 351 this->bHasHumanController_ = player->isHumanPlayer(); 352 if(controller_ != NULL)352 if(controller_ != nullptr) 353 353 this->team_ = controller_->getTeam(); // forward controller team number 354 354 … … 372 372 this->stopLocalHumanControl(); 373 373 374 this->player_ = 0;374 this->player_ = nullptr; 375 375 this->playerID_ = OBJECTID_UNKNOWN; 376 376 this->bHasLocalController_ = false; … … 411 411 { 412 412 this->camera_->attachToNode(this->cameraPositionRootNode_); 413 this->currentCameraPosition_ = 0;413 this->currentCameraPosition_ = nullptr; 414 414 } 415 415 } … … 434 434 void ControllableEntity::destroyHud(void) 435 435 { 436 if (this->hud_ != NULL)436 if (this->hud_ != nullptr) 437 437 { 438 438 this->hud_->destroy(); 439 this->hud_ = NULL;439 this->hud_ = nullptr; 440 440 } 441 441 } … … 447 447 this->camera_->detachFromParent(); 448 448 this->camera_->destroy(); 449 this->camera_ = 0;449 this->camera_ = nullptr; 450 450 } 451 451 … … 453 453 { 454 454 this->hud_->destroy(); 455 this->hud_ = 0;455 this->hud_ = nullptr; 456 456 } 457 457 } … … 477 477 if (parent) 478 478 { 479 for ( std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)480 if ( (*it)->getIsAbsolute())481 parent->attach( (*it));479 for (CameraPosition* cameraPosition : this->cameraPositions_) 480 if (cameraPosition->getIsAbsolute()) 481 parent->attach(cameraPosition); 482 482 } 483 483 }
Note: See TracChangeset
for help on using the changeset viewer.