Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6845 in orxonox.OLD


Ignore:
Timestamp:
Jan 30, 2006, 2:01:00 AM (18 years ago)
Author:
bensch
Message:

trunk: Element2D's should be loadable over the <Elements> </Elements> tab

Location:
trunk/src/story_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r6839 r6845  
    8787  this->showBV = false;
    8888
     89  this->dataXML = NULL;
    8990  this->path = NULL;
    9091}
     
    176177  /* the whole loading process for the GameWorld */
    177178  this->dataTank->loadData(root);
     179  this->dataXML = (TiXmlElement*)root->Clone();
    178180
    179181  delete XMLDoc;
     
    189191  delete this->shell;
    190192  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
     193
     194  if (this->dataXML)
     195    delete this->dataXML;
    191196
    192197  this->dataTank->unloadData();
  • trunk/src/story_entities/game_world.h

    r6839 r6845  
    8080  protected:
    8181    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
     82    TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
    8283    char*               path;                         //!< The file from which this world is loaded
    8384
  • trunk/src/story_entities/simple_game_menu.cc

    r6843 r6845  
    122122{
    123123  GameWorld::loadData();
     124
     125  if (this->dataXML != NULL)
     126  {
     127    TiXmlElement* element = this->dataXML->FirstChildElement("Elements");
     128
     129    if( element == NULL)
     130    {
     131      PRINTF(1)("SimpleGameMenu is missing 'Elements'\n");
     132    }
     133    else
     134    {
     135      element = element->FirstChildElement();
     136    // load Players/Objects/Whatever
     137      PRINTF(4)("Loading Elements\n");
     138      while( element != NULL)
     139      {
     140        BaseObject* created = Factory::fabricate(element);
     141        if( created != NULL )
     142          PRINTF(4)("Created a %s: %s\n", created->getClassName(), created->getName());
     143
     144      }
     145      PRINTF(4)("Done loading Elements\n");
     146    }
     147  }
    124148
    125149  /* get the menu list */
Note: See TracChangeset for help on using the changeset viewer.