Changeset 10211 for code/branches/presentationFS14/src
- Timestamp:
- Jan 31, 2015, 3:51:08 PM (10 years ago)
- Location:
- code/branches/presentationFS14/src/orxonox/worldentities/pawns
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10073 r10211 316 316 /** 317 317 @brief 318 Looks for an attached Engine with a certain name.319 @param name320 The name of the engine to be returned.321 @return322 Pointer to the engine with the given name, or NULL if not found.323 */324 Engine* ModularSpaceShip::getEngineByName(std::string name)325 {326 for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); ++it)327 {328 if(orxonox_cast<Engine*>(*it)->getName() == name)329 {330 return orxonox_cast<Engine*>(*it);331 }332 }333 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;334 return NULL;335 }336 337 /**338 @brief339 318 Detaches a child WorldEntity from this instance. 340 319 */ -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10073 r10211 127 127 { return this->rotationThrust_; } 128 128 129 Engine* getEngineByName(std::string name);130 129 void detach(WorldEntity* object); 131 130 -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.cc
r9667 r10211 342 342 /** 343 343 @brief 344 Looks for an attached Engine with a certain name. 345 @param name 346 The name of the engine to be returned. 347 @return 348 Pointer to the engine with the given name, or NULL if not found. 349 */ 350 Engine* SpaceShip::getEngineByName(const std::string& name) 351 { 352 for(size_t i = 0; i < this->engineList_.size(); ++i) 353 if(this->engineList_[i]->getName() == name) 354 return this->engineList_[i]; 355 356 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; 357 return NULL; 358 } 359 360 /** 361 @brief 344 362 Remove and destroy all Engines of the SpaceShip. 345 363 */ -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.h
r10073 r10211 124 124 bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine. 125 125 Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip. 126 Engine* getEngineByName(const std::string& name); 126 127 /** 127 128 @brief Get the list of all Engines that are mounted on the SpaceShip. … … 270 271 float stallSpeed_; //!< The forward speed where no more lift is added. 271 272 272 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.273 274 273 private: 275 274 void registerVariables(); … … 286 285 void backupCamera(); // Save the original position and orientation of the camera. 287 286 void resetCamera(); // Reset the camera to its original position. 287 288 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip. 288 289 289 290 Timer timer_; //!< Timer for the cooldown duration.
Note: See TracChangeset
for help on using the changeset viewer.