Changeset 9709 in orxonox.OLD for branches/new_class_id/src/story_entities/game_world_data.cc
- Timestamp:
- Aug 31, 2006, 10:51:08 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/story_entities/game_world_data.cc
r9406 r9709 23 23 #include "util/loading/resource_manager.h" 24 24 #include "state.h" 25 #include "class_list.h"26 25 #include "substring.h" 27 26 … … 41 40 42 41 #include "util/loading/factory.h" 43 #include " fast_factory.h"42 #include "loading/fast_factory.h" 44 43 #include "util/loading/load_param.h" 45 44 46 45 #include "graphics_engine.h" 46 #include "effects/graphics_effect.h" 47 47 #include "effects/atmospheric_engine.h" 48 48 #include "event_handler.h" … … 61 61 62 62 63 64 65 63 NewObjectListDefinition(GameWorldData); 66 64 /** 67 65 * constructor of the GameWorldData … … 69 67 GameWorldData::GameWorldData() 70 68 { 71 this-> setClassID(CL_GAME_WORLD_DATA, "GameWorldData");69 this->registerObject(this, GameWorldData::_objectList); 72 70 73 71 this->glmis = NULL; … … 215 213 216 214 //todo do this more elegant 217 if( element->Value() == "SkyBox" && created->isA( CL_SKYBOX))215 if( element->Value() == "SkyBox" && created->isA(SkyBox::classID())) 218 216 { 219 217 this->sky = dynamic_cast<WorldEntity*>(created); 220 218 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky)); 221 219 } 222 if( element->Value() == "Terrain" && created->isA( CL_TERRAIN))220 if( element->Value() == "Terrain" && created->isA(Terrain::classID())) 223 221 { 224 222 this->terrain = dynamic_cast<Terrain*>(created); … … 236 234 237 235 Playable* playable; 238 const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 239 if (playableList != NULL && !playableList->empty()) 236 if (!Playable::objectList().empty()) 240 237 { 241 238 /// TODO Make this also loadable 242 playable = dynamic_cast<Playable*>(playableList->front()); 243 this->localPlayer->setPlayable(playable); 239 this->localPlayer->setPlayable(Playable::objectList().back()); 244 240 } 245 241 … … 280 276 GraphicsEngine::getInstance()->displayFPS(false); 281 277 // erease everything that is left. 282 // delete PNode::getNullParent(); // not needed as this is also done in the next step (and also much cleaner)283 const std::list<BaseObject*>* nodeList;284 278 //secondary cleanup of PNodes; 285 nodeList = ClassList::getList(CL_PARENT_NODE); 286 if (nodeList != NULL) 287 while (!nodeList->empty()) 288 { 289 // ClassList::debug( 3, CL_PARENT_NODE); 290 // PNode::getNullParent()->debugNode(0); 291 // printf("%s::%s\n", nodeList->front()->getClassCName(), nodeList->front()->getName()); 292 delete nodeList->front(); 293 } 279 while (!PNode::objectList().empty()) 280 delete PNode::objectList().front(); 281 294 282 /* remove the player object */ 295 283 if( this->localPlayer) … … 302 290 this->terrain = NULL; 303 291 304 nodeList = ClassList::getList(CL_GRAPHICS_EFFECT); 305 if (nodeList != NULL) 306 while (!nodeList->empty()) 307 delete nodeList->front(); 308 309 310 nodeList = ClassList::getList(CL_ELEMENT_2D); 311 if (nodeList != NULL) 312 while (!nodeList->empty()) 313 delete nodeList->front(); 292 while (!GraphicsEffect::objectList().empty()) 293 delete GraphicsEffect::objectList().front(); 294 295 296 while (!Element2D::objectList().empty()) 297 delete Element2D::objectList().front(); 314 298 315 299 // At this Point all the WorldEntites should be unloaded. … … 414 398 PRINTF(2)("creating %s\n", element->Value()); 415 399 BaseObject* created = Factory::fabricate(element); 416 if (created != NULL && created->isA( CL_GAME_RULES))400 if (created != NULL && created->isA(GameRules::classID())) 417 401 { 418 402 this->gameRule = dynamic_cast<GameRules*>(created);
Note: See TracChangeset
for help on using the changeset viewer.