Changeset 3049 for code/trunk/src/orxonox/objects/worldentities
- Timestamp:
- May 25, 2009, 3:26:43 AM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects/worldentities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
r3038 r3049 40 40 #include "objects/Scene.h" 41 41 #include "objects/infos/PlayerInfo.h" 42 #include "objects/controllers/Controller.h" 42 43 #include "objects/worldentities/Camera.h" 43 44 #include "objects/worldentities/CameraPosition.h" … … 61 62 this->hud_ = 0; 62 63 this->camera_ = 0; 64 this->xmlcontroller_ = 0; 63 65 this->bDestroyWhenPlayerLeft_ = false; 64 66 this->cameraPositionRootNode_ = this->node_->createChildSceneNode(); … … 93 95 this->getPlayer()->stopControl(); 94 96 97 if (this->xmlcontroller_) 98 delete this->xmlcontroller_; 99 95 100 if (this->hud_) 96 101 delete this->hud_; … … 115 120 116 121 XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode); 122 XMLPortObject(ControllableEntity, Controller, "controller", setXMLController, getXMLController, xmlelement, mode); 117 123 } 118 124 … … 304 310 } 305 311 312 void ControllableEntity::setXMLController(Controller* controller) 313 { 314 if (!this->xmlcontroller_) 315 { 316 this->xmlcontroller_ = controller; 317 this->bHasLocalController_ = true; 318 this->xmlcontroller_->setControllableEntity(this); 319 } 320 else 321 COUT(2) << "Warning: ControllableEntity \"" << this->getName() << "\" already has a Controller." << std::endl; 322 } 323 306 324 void ControllableEntity::parentChanged() 307 325 { -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
r3038 r3049 130 130 { return this->mouseLookSpeed_; } 131 131 132 inline Controller* getXMLController() const 133 { return this->xmlcontroller_; } 134 132 135 protected: 133 136 virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead … … 142 145 143 146 private: 147 void setXMLController(Controller* controller); 148 144 149 void overwrite(); 145 150 void processOverwrite(); … … 188 193 std::list<CameraPosition*> cameraPositions_; 189 194 std::string cameraPositionTemplate_; 195 Controller* xmlcontroller_; 190 196 }; 191 197 }
Note: See TracChangeset
for help on using the changeset viewer.