Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7370 in orxonox.OLD for trunk/src/story_entities/game_world_data.cc


Ignore:
Timestamp:
Apr 26, 2006, 1:31:01 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: drawLists/tickLists are used, and made some TiXmlElement to const TiXmlElement, also fixed some bugs in the loadWorldEntities-functions from Gameworld and SipleGameMenu

File:
1 edited

Legend:

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

    r7369 r7370  
    114114 * @param root reference to the xml root element
    115115 */
    116 ErrorMessage GameWorldData::loadData(TiXmlElement* root)
     116ErrorMessage GameWorldData::loadData(const TiXmlElement* root)
    117117{
    118118  // load the parameters
     
    145145
    146146/**
    147  * loads the GUI data
     147 * @brief loads the GUI data
    148148 * @param root reference to the xml root element
    149149 */
    150 ErrorMessage GameWorldData::loadGUI(TiXmlElement* root)
    151 {
    152   TiXmlElement* element = root->FirstChildElement("LoadScreen");
     150ErrorMessage GameWorldData::loadGUI(const TiXmlElement* root)
     151{
     152  const TiXmlElement* element = root->FirstChildElement("LoadScreen");
    153153  if( element == NULL)
    154154  {
     
    169169
    170170/**
    171  * unloads the GUI data
     171 * @brief unloads the GUI data
    172172 */
    173173ErrorMessage GameWorldData::unloadGUI()
     
    178178
    179179/**
    180  * loads the world entities from the xml file
     180 * @brief loads the world entities from the xml file
    181181 * @param root reference to the xml root parameter
    182182 */
    183 ErrorMessage GameWorldData::loadWorldEntities(TiXmlElement* root)
    184 {
    185   TiXmlElement* element = root->FirstChildElement("WorldEntities");
     183ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root)
     184{
     185  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
    186186
    187187  if( element == NULL)
     
    201201
    202202      //todo do this more elegant
    203       if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     203      if( element->Value() == "SkyBox" && created->isA(CL_SKYBOX))
    204204      {
    205205        this->sky = dynamic_cast<WorldEntity*>(created);
    206206        State::setSkyBox(dynamic_cast<SkyBox*>(this->sky));
    207207      }
    208       if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
     208      if( element->Value() == "Terrain" && created->isA(CL_TERRAIN))
    209209      {
    210210        this->terrain = dynamic_cast<Terrain*>(created);
     
    223223  Playable* playable;
    224224  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    225   if (playableList != NULL)
    226   {
     225  if (playableList != NULL && !playableList->empty())
     226  {
     227    /// TODO Make this also loadable
    227228    playable = dynamic_cast<Playable*>(playableList->front());
    228229    this->localPlayer->setPlayable(playable);
    229230  }
     231
     232  // Fill the EntityLists. Tick then Draw:
     233  this->tickLists.push_back(OM_DEAD_TICK);
     234  this->tickLists.push_back(OM_ENVIRON);
     235  this->tickLists.push_back(OM_COMMON);
     236  this->tickLists.push_back(OM_GROUP_00);
     237  this->tickLists.push_back(OM_GROUP_00_PROJ);
     238  this->tickLists.push_back(OM_GROUP_01);
     239  this->tickLists.push_back(OM_GROUP_01_PROJ);
     240
     241  this->drawLists.push_back(OM_ENVIRON_NOTICK);
     242  this->drawLists.push_back(OM_ENVIRON);
     243  this->drawLists.push_back(OM_COMMON);
     244  this->drawLists.push_back(OM_GROUP_00);
     245  this->drawLists.push_back(OM_GROUP_00_PROJ);
     246  this->drawLists.push_back(OM_GROUP_01);
     247  this->drawLists.push_back(OM_GROUP_01_PROJ);
    230248
    231249  /* init the pnode tree */
     
    248266  if (nodeList != NULL)
    249267    while (!nodeList->empty())
    250   {
    251 //    ClassList::debug( 3, CL_PARENT_NODE);
    252 //    PNode::getNullParent()->debugNode(0);
    253 //    printf("%s::%s\n", nodeList->front()->getClassName(), nodeList->front()->getName());
    254     delete nodeList->front();
    255   }
     268    {
     269      //    ClassList::debug( 3, CL_PARENT_NODE);
     270      //    PNode::getNullParent()->debugNode(0);
     271      //    printf("%s::%s\n", nodeList->front()->getClassName(), nodeList->front()->getName());
     272      delete nodeList->front();
     273    }
    256274  /* remove the player object */
    257275  if( this->localPlayer)
     
    271289
    272290  nodeList = ClassList::getList(CL_ELEMENT_2D);
    273     if (nodeList != NULL)
    274        while (!nodeList->empty())
    275          delete nodeList->front();
    276 
    277 
    278 
    279 
    280   // unload the resources !!
     291  if (nodeList != NULL)
     292    while (!nodeList->empty())
     293      delete nodeList->front();
     294
     295  // At this Point all the WorldEntites should be unloaded.
     296  this->tickLists.clear();
     297  this->drawLists.clear();
     298
     299  // unload the resources loaded in this Level !!
    281300  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
    282301
     
    296315
    297316/**
    298  * loads the scene data
     317 * @brief loads the scene data
    299318 * @param root reference to the xml root element
    300319 */
    301 ErrorMessage GameWorldData::loadScene(TiXmlElement* root)
     320ErrorMessage GameWorldData::loadScene(const TiXmlElement* root)
    302321{
    303322  LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
Note: See TracChangeset for help on using the changeset viewer.