- Timestamp:
- Jan 10, 2007, 11:56:16 PM (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
r10216 r10231 45 45 46 46 47 /**48 * constructor49 * @param root the xml root element50 */51 MountPoint::MountPoint(const TiXmlElement* root)52 {53 this->init();54 55 if( root != NULL)56 this->loadParams(root);57 }58 59 47 60 48 /** … … 81 69 * @param root the XML-element to load the MD2Creature's properties from 82 70 */ 83 void MountPoint:: loadParams(const TiXmlElement* root)71 void MountPoint::initMountPoint(const TiXmlElement* root) 84 72 { 85 WorldEntity::loadParams(root); 73 const TiXmlElement* element = root->FirstChildElement("MountPoints"); 74 if( element == NULL) 75 { 76 PRINTF(1)("Object Information file is missing a proper 'MountPoints' section\n"); 77 } 78 else 79 { 80 element = element->FirstChildElement(); 81 // parse the information for this mount point 82 83 PRINTF(4)("Loading WorldEntities\n"); 84 while( element != NULL) 85 { 86 BaseObject* created = Factory::fabricate(element); 87 if( created != NULL ) 88 PRINTF(4)("Created a %s: %s\n", created->getClassCName(), created->getCName()); 89 90 //todo do this more elegant 91 if( element->Value() == "SkyBox" && created->isA(SkyBox::staticClassID())) 92 { 93 this->sky = dynamic_cast<WorldEntity*>(created); 94 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky)); 95 } 96 if( element->Value() == "Terrain" && created->isA(Terrain::staticClassID())) 97 { 98 this->terrain = dynamic_cast<Terrain*>(created); 99 CDEngine::getInstance()->setTerrain(terrain); 100 } 101 element = element->NextSiblingElement(); 102 this->glmis->step(); //! @todo temporary 103 } 104 PRINTF(4)("Done loading WorldEntities\n"); 105 } 86 106 } 87 107 -
branches/mount_points/src/world_entities/mount_point.h
r10184 r10231 13 13 public: 14 14 MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name); 15 MountPoint(const TiXmlElement* root);16 15 virtual ~MountPoint (); 17 16 18 17 void init(); 19 v irtual void loadParams(const TiXmlElement* root);18 void initMountPoint(const TiXmlElement* root); 20 19 21 20
Note: See TracChangeset
for help on using the changeset viewer.