Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10231 in orxonox.OLD


Ignore:
Timestamp:
Jan 10, 2007, 11:56:16 PM (17 years ago)
Author:
patrick
Message:

more on mount points

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  
    4545
    4646
    47 /**
    48  * constructor
    49  * @param root the xml root element
    50  */
    51 MountPoint::MountPoint(const TiXmlElement* root)
    52 {
    53   this->init();
    54 
    55   if( root != NULL)
    56     this->loadParams(root);
    57 }
    58 
    5947
    6048/**
     
    8169 * @param root the XML-element to load the MD2Creature's properties from
    8270 */
    83 void MountPoint::loadParams(const TiXmlElement* root)
     71void MountPoint::initMountPoint(const TiXmlElement* root)
    8472{
    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  }
    86106}
    87107
  • branches/mount_points/src/world_entities/mount_point.h

    r10184 r10231  
    1313  public:
    1414    MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name);
    15     MountPoint(const TiXmlElement* root);
    1615    virtual ~MountPoint ();
    1716
    1817    void init();
    19     virtual void loadParams(const TiXmlElement* root);
     18    void initMountPoint(const TiXmlElement* root);
    2019
    2120
Note: See TracChangeset for help on using the changeset viewer.