Changeset 8568 for code/branches/presentation/src
- Timestamp:
- May 24, 2011, 10:41:43 PM (13 years ago)
- Location:
- code/branches/presentation/src/modules/docking
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/docking/DockToShip.cc
r8561 r8568 59 59 60 60 void DockToShip::setTargetId(const std::string& str) { 61 this->target = str;61 this->target_ = str; 62 62 } 63 63 64 64 const std::string& DockToShip::getTargetId() const { 65 return this->target ;65 return this->target_; 66 66 } 67 67 … … 71 71 COUT(4) << "DockToShip::attach" << endl; 72 72 73 DockingTarget *target = DockingEffect::findTarget(this->target );73 DockingTarget *target = DockingEffect::findTarget(this->target_); 74 74 if (target == NULL) { 75 COUT(0) << "Can't retrieve target for '" << this->target << "'.." << std::endl;75 COUT(0) << "Can't retrieve target for '" << this->target_ << "'.." << std::endl; 76 76 return false; 77 77 } -
code/branches/presentation/src/modules/docking/DockToShip.h
r8561 r8568 67 67 virtual bool release(PlayerInfo* player); //!< Called when player wants undock 68 68 private: 69 std::string target ;69 std::string target_; 70 70 }; 71 71 -
code/branches/presentation/src/modules/docking/DockingAnimation.cc
r8561 r8568 41 41 { 42 42 RegisterObject(DockingAnimation); 43 44 this->parent_ = NULL; 43 45 } 44 46 -
code/branches/presentation/src/modules/docking/DockingAnimation.h
r8561 r8568 73 73 static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target 74 74 75 void setParent(Dock *parent) { this->parent = parent; }75 void setParent(Dock *parent) { this->parent_ = parent; } 76 76 77 77 protected: 78 Dock *parent ;79 std::set<PlayerInfo*> animations ; //!< Contains a list of currently running animations78 Dock *parent_; 79 std::set<PlayerInfo*> animations_; //!< Contains a list of currently running animations 80 80 }; 81 81 -
code/branches/presentation/src/modules/docking/DockingController.cc
r8561 r8568 42 42 { 43 43 RegisterObject(DockingController); 44 45 this->dock_ = NULL; 46 this->player_ = NULL; 47 this->entity_ = NULL; 44 48 } 45 49 … … 55 59 return; 56 60 57 float distance = ( dock->getWorldPosition() - entity->getPosition()).length();61 float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length(); 58 62 Vector2 coord = get2DViewdirection( // I don't understand this too 59 63 entity->getPosition(), 60 64 entity->getOrientation() * WorldEntity::FRONT, 61 65 entity->getOrientation() * WorldEntity::UP, 62 dock ->getWorldPosition()66 dock_->getWorldPosition() 63 67 ); 64 68 … … 86 90 void DockingController::takeControl(bool docking) 87 91 { 88 this->docking = docking;92 this->docking_ = docking; 89 93 90 entity = player->getControllableEntity();91 assert( entity);94 this->entity_ = this->player_->getControllableEntity(); 95 assert(this->entity_); 92 96 93 97 if (docking) … … 95 99 COUT(4) << "DockingController::takeControl Taking over control." << std::endl; 96 100 97 entity->setDestroyWhenPlayerLeft(false);98 player->pauseControl();99 entity->setController(this);100 this->setControllableEntity( entity);101 this->entity_->setDestroyWhenPlayerLeft(false); 102 this->player_->pauseControl(); 103 this->entity_->setController(this); 104 this->setControllableEntity(this->entity_); 101 105 } 102 106 } … … 106 110 COUT(4) << "DockingController::positionReached() called." << std::endl; 107 111 108 assert(this->player );109 assert(this->dock );112 assert(this->player_); 113 assert(this->dock_); 110 114 111 115 // stop spaceship 112 entity->setPosition(dock->getWorldPosition());113 entity->setVelocity(0, 0, 0);114 entity->setOrientation(dock->getWorldOrientation());116 this->entity_->setPosition(this->dock_->getWorldPosition()); 117 this->entity_->setVelocity(0, 0, 0); 118 this->entity_->setOrientation(this->dock_->getWorldOrientation()); 115 119 116 120 // give control back to player 117 player->startControl(entity);121 this->player_->startControl(this->entity_); 118 122 this->setActive(false); 119 123 this->controllableEntity_ = NULL; 120 124 121 if ( docking)122 dock->dockingAnimationFinished(player);125 if (this->docking_) 126 this->dock_->dockingAnimationFinished(this->player_); 123 127 /*else 124 128 dock->undockingAnimationFinished(player);*/ -
code/branches/presentation/src/modules/docking/DockingController.h
r8561 r8568 49 49 void takeControl(bool docking); 50 50 51 void setDock(Dock* dock) { this->dock = dock; }52 void setPlayer(PlayerInfo* player) { this->player = player; }51 void setDock(Dock* dock) { this->dock_ = dock; } 52 void setPlayer(PlayerInfo* player) { this->player_ = player; } 53 53 54 54 protected: … … 56 56 57 57 private: 58 bool docking ;58 bool docking_; 59 59 60 Dock* dock ;61 PlayerInfo* player ;60 Dock* dock_; 61 PlayerInfo* player_; 62 62 63 ControllableEntity* entity ;63 ControllableEntity* entity_; 64 64 }; 65 65 } -
code/branches/presentation/src/modules/docking/DockingEffect.cc
r8561 r8568 62 62 63 63 DockingTarget *DockingEffect::findTarget(std::string name) { 64 for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); 65 it != ObjectList<DockingTarget>::end(); ++it) 64 for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it) 66 65 { 67 66 if ((*it)->getName().compare(name) == 0) -
code/branches/presentation/src/modules/docking/DockingTarget.cc
r8561 r8568 60 60 61 61 void DockingTarget::setName(const std::string& str) { 62 this->name = str;62 this->name_ = str; 63 63 } 64 64 65 65 const std::string& DockingTarget::getName() const { 66 return this->name ;66 return this->name_; 67 67 } 68 68 } -
code/branches/presentation/src/modules/docking/DockingTarget.h
r8561 r8568 55 55 { 56 56 private: 57 std::string name ;57 std::string name_; 58 58 59 59 public: -
code/branches/presentation/src/modules/docking/MoveToDockingTarget.cc
r8561 r8568 52 52 bool MoveToDockingTarget::docking(PlayerInfo *player) 53 53 { 54 assert( parent);54 assert(this->parent_); 55 55 56 56 DockingController *dockingController = new DockingController(this); 57 dockingController->setDock( parent);57 dockingController->setDock(this->parent_); 58 58 dockingController->setPlayer(player); 59 59 dockingController->takeControl(true); … … 65 65 { 66 66 //TODO: Investigate strange things... 67 parent->detach((WorldEntity*)player->getControllableEntity());67 this->parent_->detach((WorldEntity*)player->getControllableEntity()); 68 68 69 parent->undockingAnimationFinished(player);69 this->parent_->undockingAnimationFinished(player); 70 70 return true; 71 71 }
Note: See TracChangeset
for help on using the changeset viewer.