Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2006, 10:51:08 PM (18 years ago)
Author:
bensch
Message:

orxonox/branches/new_class_id: new_class ID working, adapdet many classes, and reinvented some of the ClassID stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/story_entities/game_world_data.cc

    r9406 r9709  
    2323#include "util/loading/resource_manager.h"
    2424#include "state.h"
    25 #include "class_list.h"
    2625#include "substring.h"
    2726
     
    4140
    4241#include "util/loading/factory.h"
    43 #include "fast_factory.h"
     42#include "loading/fast_factory.h"
    4443#include "util/loading/load_param.h"
    4544
    4645#include "graphics_engine.h"
     46#include "effects/graphics_effect.h"
    4747#include "effects/atmospheric_engine.h"
    4848#include "event_handler.h"
     
    6161
    6262
    63 
    64 
    65 
     63NewObjectListDefinition(GameWorldData);
    6664/**
    6765 * constructor of the GameWorldData
     
    6967GameWorldData::GameWorldData()
    7068{
    71   this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData");
     69  this->registerObject(this, GameWorldData::_objectList);
    7270
    7371  this->glmis = NULL;
     
    215213
    216214      //todo do this more elegant
    217       if( element->Value() == "SkyBox" && created->isA(CL_SKYBOX))
     215      if( element->Value() == "SkyBox" && created->isA(SkyBox::classID()))
    218216      {
    219217        this->sky = dynamic_cast<WorldEntity*>(created);
    220218        State::setSkyBox(dynamic_cast<SkyBox*>(this->sky));
    221219      }
    222       if( element->Value() == "Terrain" && created->isA(CL_TERRAIN))
     220      if( element->Value() == "Terrain" && created->isA(Terrain::classID()))
    223221      {
    224222        this->terrain = dynamic_cast<Terrain*>(created);
     
    236234
    237235  Playable* playable;
    238   const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    239   if (playableList != NULL && !playableList->empty())
     236  if (!Playable::objectList().empty())
    240237  {
    241238    /// TODO Make this also loadable
    242     playable = dynamic_cast<Playable*>(playableList->front());
    243     this->localPlayer->setPlayable(playable);
     239    this->localPlayer->setPlayable(Playable::objectList().back());
    244240  }
    245241
     
    280276  GraphicsEngine::getInstance()->displayFPS(false);
    281277  // 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;
    284278  //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
    294282  /* remove the player object */
    295283  if( this->localPlayer)
     
    302290  this->terrain = NULL;
    303291
    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();
    314298
    315299  // At this Point all the WorldEntites should be unloaded.
     
    414398    PRINTF(2)("creating %s\n", element->Value());
    415399    BaseObject* created = Factory::fabricate(element);
    416     if (created != NULL && created->isA(CL_GAME_RULES))
     400    if (created != NULL && created->isA(GameRules::classID()))
    417401    {
    418402      this->gameRule = dynamic_cast<GameRules*>(created);
Note: See TracChangeset for help on using the changeset viewer.