- Timestamp:
- May 15, 2014, 3:53:11 PM (11 years ago)
- Location:
- code/branches/modularships/src/orxonox/worldentities/pawns
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10055 r10058 40 40 41 41 #include "items/ShipPart.h" 42 #include "items/Engine.h" 42 43 #include "worldentities/StaticEntity.h" 43 44 #include "collisionshapes/WorldEntityCollisionShape.h" … … 230 231 /** 231 232 @brief 233 Looks for an attached ShipPart with a certain name. 234 @param name 235 The name of the ShipPart to be returned. 236 @return 237 Pointer to the ShipPart with the given name, or NULL if not found. 238 */ 239 ShipPart* ModularSpaceShip::getShipPartByName(std::string name) 240 { 241 for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it) 242 { 243 if(orxonox_cast<ShipPart*>(*it)->getName() == name) 244 { 245 return orxonox_cast<ShipPart*>(*it); 246 } 247 } 248 orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl; 249 return NULL; 250 } 251 252 /** 253 @brief 232 254 Check whether the SpaceShip has a particular Engine. 233 255 @param engine … … 285 307 /** 286 308 @brief 309 Looks for an attached Engine with a certain name. 310 @param name 311 The name of the engine to be returned. 312 @return 313 Pointer to the engine with the given name, or NULL if not found. 314 */ 315 Engine* ModularSpaceShip::getEngineByName(std::string name) 316 { 317 for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); ++it) 318 { 319 if(orxonox_cast<Engine*>(*it)->getName() == name) 320 { 321 return orxonox_cast<Engine*>(*it); 322 } 323 } 324 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; 325 return NULL; 326 } 327 328 /** 329 @brief 287 330 Detaches a child WorldEntity from this instance. 288 331 */ … … 297 340 298 341 // collision shapes 299 orxout() << "MSS: detach()" << endl;300 342 301 343 //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0); … … 314 356 315 357 object->notifyDetached(); 316 orxout() << "MSS: detach() completed." << endl;317 358 } 318 359 } -
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10055 r10058 117 117 void addShipPart(ShipPart* part); 118 118 ShipPart* getShipPart(unsigned int index); 119 ShipPart* getShipPartByName(std::string name); 119 120 bool hasShipPart(ShipPart* part) const; 120 121 void removeShipPart(ShipPart* part); 121 122 123 inline void setRotationThrust(float val) 124 { this->rotationThrust_ = val; } 125 inline float getRotationThrust() 126 { return this->rotationThrust_; } 127 128 Engine* getEngineByName(std::string name); 122 129 void detach(WorldEntity* object); 123 130 -
code/branches/modularships/src/orxonox/worldentities/pawns/SpaceShip.h
r9667 r10058 270 270 float stallSpeed_; //!< The forward speed where no more lift is added. 271 271 272 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip. 273 272 274 private: 273 275 void registerVariables(); … … 284 286 void backupCamera(); // Save the original position and orientation of the camera. 285 287 void resetCamera(); // Reset the camera to its original position. 286 287 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.288 288 289 289 Timer timer_; //!< Timer for the cooldown duration.
Note: See TracChangeset
for help on using the changeset viewer.