Changeset 2907 for code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.cc
- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/worldentities/ControllableEntity.cc
r2662 r2907 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "core/XMLPort.h" 38 38 #include "core/Template.h" … … 144 144 void ControllableEntity::addCameraPosition(CameraPosition* position) 145 145 { 146 if (position->getAllowMouseLook()) 147 position->attachToNode(this->cameraPositionRootNode_); 146 if (!position->getIsAbsolute()) 147 { 148 if (position->getAllowMouseLook()) 149 position->attachToNode(this->cameraPositionRootNode_); 150 else 151 this->attach(position); 152 } 148 153 else 149 this->attach(position); 154 { 155 WorldEntity* parent = this->getParent(); 156 if (parent) 157 parent->attach(position); 158 } 150 159 this->cameraPositions_.push_back(position); 151 160 } … … 236 245 this->startLocalHumanControl(); 237 246 238 if (! Core::isMaster())247 if (!GameMode::isMaster()) 239 248 { 240 249 this->client_overwrite_ = this->server_overwrite_; … … 242 251 } 243 252 } 253 254 this->changedPlayer(); 244 255 } 245 256 … … 254 265 this->bHasHumanController_ = false; 255 266 this->setObjectMode(objectDirection::toclient); 267 268 this->changedPlayer(); 256 269 257 270 if (this->bDestroyWhenPlayerLeft_) … … 322 335 } 323 336 337 void ControllableEntity::parentChanged() 338 { 339 WorldEntity::parentChanged(); 340 341 WorldEntity* parent = this->getParent(); 342 if (parent) 343 { 344 for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 345 if ((*it)->getIsAbsolute()) 346 parent->attach((*it)); 347 } 348 } 349 324 350 void ControllableEntity::tick(float dt) 325 351 { … … 331 357 if (!this->isDynamic()) 332 358 { 333 if ( Core::isMaster())359 if (GameMode::isMaster()) 334 360 { 335 361 this->server_position_ = this->getPosition(); … … 446 472 void ControllableEntity::setPosition(const Vector3& position) 447 473 { 448 if ( Core::isMaster())474 if (GameMode::isMaster()) 449 475 { 450 476 MobileEntity::setPosition(position); … … 461 487 void ControllableEntity::setOrientation(const Quaternion& orientation) 462 488 { 463 if ( Core::isMaster())489 if (GameMode::isMaster()) 464 490 { 465 491 MobileEntity::setOrientation(orientation); … … 476 502 void ControllableEntity::setVelocity(const Vector3& velocity) 477 503 { 478 if ( Core::isMaster())504 if (GameMode::isMaster()) 479 505 { 480 506 MobileEntity::setVelocity(velocity); … … 491 517 void ControllableEntity::setAngularVelocity(const Vector3& velocity) 492 518 { 493 if ( Core::isMaster())519 if (GameMode::isMaster()) 494 520 { 495 521 MobileEntity::setAngularVelocity(velocity); … … 507 533 { 508 534 MobileEntity::setWorldTransform(worldTrans); 509 if ( Core::isMaster())535 if (GameMode::isMaster()) 510 536 { 511 537 this->server_position_ = this->getPosition();
Note: See TracChangeset
for help on using the changeset viewer.