Changeset 7370 in orxonox.OLD for trunk/src/story_entities/game_world_data.cc
- Timestamp:
- Apr 26, 2006, 1:31:01 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world_data.cc
r7369 r7370 114 114 * @param root reference to the xml root element 115 115 */ 116 ErrorMessage GameWorldData::loadData( TiXmlElement* root)116 ErrorMessage GameWorldData::loadData(const TiXmlElement* root) 117 117 { 118 118 // load the parameters … … 145 145 146 146 /** 147 * loads the GUI data147 * @brief loads the GUI data 148 148 * @param root reference to the xml root element 149 149 */ 150 ErrorMessage GameWorldData::loadGUI( TiXmlElement* root)151 { 152 TiXmlElement* element = root->FirstChildElement("LoadScreen");150 ErrorMessage GameWorldData::loadGUI(const TiXmlElement* root) 151 { 152 const TiXmlElement* element = root->FirstChildElement("LoadScreen"); 153 153 if( element == NULL) 154 154 { … … 169 169 170 170 /** 171 * unloads the GUI data171 * @brief unloads the GUI data 172 172 */ 173 173 ErrorMessage GameWorldData::unloadGUI() … … 178 178 179 179 /** 180 * loads the world entities from the xml file180 * @brief loads the world entities from the xml file 181 181 * @param root reference to the xml root parameter 182 182 */ 183 ErrorMessage GameWorldData::loadWorldEntities( TiXmlElement* root)184 { 185 TiXmlElement* element = root->FirstChildElement("WorldEntities");183 ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root) 184 { 185 const TiXmlElement* element = root->FirstChildElement("WorldEntities"); 186 186 187 187 if( element == NULL) … … 201 201 202 202 //todo do this more elegant 203 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))203 if( element->Value() == "SkyBox" && created->isA(CL_SKYBOX)) 204 204 { 205 205 this->sky = dynamic_cast<WorldEntity*>(created); 206 206 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky)); 207 207 } 208 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))208 if( element->Value() == "Terrain" && created->isA(CL_TERRAIN)) 209 209 { 210 210 this->terrain = dynamic_cast<Terrain*>(created); … … 223 223 Playable* playable; 224 224 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 227 228 playable = dynamic_cast<Playable*>(playableList->front()); 228 229 this->localPlayer->setPlayable(playable); 229 230 } 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); 230 248 231 249 /* init the pnode tree */ … … 248 266 if (nodeList != NULL) 249 267 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 } 256 274 /* remove the player object */ 257 275 if( this->localPlayer) … … 271 289 272 290 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 !! 281 300 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); 282 301 … … 296 315 297 316 /** 298 * loads the scene data317 * @brief loads the scene data 299 318 * @param root reference to the xml root element 300 319 */ 301 ErrorMessage GameWorldData::loadScene( TiXmlElement* root)320 ErrorMessage GameWorldData::loadScene(const TiXmlElement* root) 302 321 { 303 322 LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
Note: See TracChangeset
for help on using the changeset viewer.