Changeset 10232 in orxonox.OLD for branches/mount_points/src
- Timestamp:
- Jan 11, 2007, 12:10:24 AM (18 years ago)
- Location:
- branches/mount_points/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mount_points/src/world_entities/mount_point.cc
r10231 r10232 84 84 while( element != NULL) 85 85 { 86 BaseObject* created = Factory::fabricate(element); 87 if( created != NULL ) 88 PRINTF(4)("Created a %s: %s\n", created->getClassCName(), created->getCName()); 86 std::string name = element->Value(); 89 87 90 // todo do this more elegant91 if( element->Value() == "SkyBox" && created->isA(SkyBox::staticClassID()))88 // check if we got the right mount point 89 if( name == this->_name) 92 90 { 93 this->sky = dynamic_cast<WorldEntity*>(created);94 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky));91 // load it 92 this->loadParam(element); 95 93 } 96 if( element->Value() == "Terrain" && created->isA(Terrain::staticClassID())) 97 { 98 this->terrain = dynamic_cast<Terrain*>(created); 99 CDEngine::getInstance()->setTerrain(terrain); 100 } 94 101 95 element = element->NextSiblingElement(); 102 this->glmis->step(); //! @todo temporary103 96 } 104 PRINTF(4)("Done loading WorldEntities\n");105 97 } 98 } 99 100 101 102 /** 103 * load the parameters from the xml section 104 * @param root the root element of this xml branche 105 */ 106 void MountPoint::loadParam(const TiXmlElement* root) 107 { 108 LoadParam(root, "description", this, WorldEntity, setDescription) 109 .describe("Sets this mount point a description"); 110 111 112 LoadParam(root, "OrxClass", this, WorldEntity, setOrxClass) 113 .describe("Sets the class this mount points should host"); 114 } 115 116 117 118 /** 119 * setst the description (optional) via xml tag 120 * @param description string containing the description 121 */ 122 void MountPoint::setDescription(const std::string& description) 123 { 124 this->_description = description; 125 } 126 127 128 129 /** 130 * sets the class of this mount point 131 * @param orxClass class 132 */ 133 void MountPoint::setOrxClass(const std::string& orxClass) 134 { 135 // create the object for this mount point 136 this->_mount = Factory::fabricate(orxClass); 137 // check if the object is created correctly 138 if( this->_mount == NULL) 139 PRINTF(1)("Couldn't create %s for this mount point (%s)\n", orxClass.c_str(), this->_name.c_str()); 106 140 } 107 141 -
branches/mount_points/src/world_entities/mount_point.h
r10231 r10232 17 17 void init(); 18 18 void initMountPoint(const TiXmlElement* root); 19 void loadParam(const TiXmlElement* root); 19 20 21 void setDescription(const std::string& description); 22 void setOrxClass(const std::string& orxClass); 20 23 21 24 virtual void tick (float time); … … 33 36 std::string _name; //!< the name of the mount point 34 37 38 std::string _description; //!< string containing an optional description 39 35 40 }; 36 41
Note: See TracChangeset
for help on using the changeset viewer.