Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

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

    r9406 r9869  
    2121#include "game_world_data.h"
    2222
     23#include "state.h"
     24#include "substring.h"
     25
     26#include "util/loading/game_loader.h"
    2327#include "util/loading/resource_manager.h"
    24 #include "state.h"
    25 #include "class_list.h"
    26 #include "substring.h"
    27 
    28 #include "util/loading/game_loader.h"
    2928
    3029#include "world_entity.h"
     
    4140
    4241#include "util/loading/factory.h"
    43 #include "fast_factory.h"
    44 #include "util/loading/load_param.h"
     42#include "loading/fast_factory.h"
     43#include "util/loading/load_param_xml.h"
    4544
    4645#include "graphics_engine.h"
    47 #include "effects/atmospheric_engine.h"
     46#include "graphics_effect.h"
     47#include "weather_effects/atmospheric_engine.h"
    4848#include "event_handler.h"
    4949#include "sound_engine.h"
     
    5151#include "network_manager.h"
    5252#include "physics_engine.h"
    53 #include "fields.h"
    5453
    5554#include "glmenu_imagescreen.h"
     
    6160
    6261
    63 
    64 
    65 
     62ObjectListDefinition(GameWorldData);
    6663/**
    6764 * constructor of the GameWorldData
     
    6966GameWorldData::GameWorldData()
    7067{
    71   this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData");
     68  this->registerObject(this, GameWorldData::_objectList);
    7269
    7370  this->glmis = NULL;
     
    119116ErrorMessage GameWorldData::loadData(const TiXmlElement* root)
    120117{
     118  assert (root != NULL);
    121119  // load the parameters
    122120  // name
    123   std::string string = grabParameter( root, "name");
     121  std::string string = LoadParamBase::grabParameter( root, "name");
    124122  if( string.empty() )
    125123  {
     
    194192ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root)
    195193{
    196 
    197194  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
    198195  bool mouseCaptured = EventHandler::getInstance()->grabbedEvents();
     
    215212
    216213      //todo do this more elegant
    217       if( element->Value() == "SkyBox" && created->isA(CL_SKYBOX))
     214      if( element->Value() == "SkyBox" && created->isA(SkyBox::staticClassID()))
    218215      {
    219216        this->sky = dynamic_cast<WorldEntity*>(created);
    220217        State::setSkyBox(dynamic_cast<SkyBox*>(this->sky));
    221218      }
    222       if( element->Value() == "Terrain" && created->isA(CL_TERRAIN))
     219      if( element->Value() == "Terrain" && created->isA(Terrain::staticClassID()))
    223220      {
    224221        this->terrain = dynamic_cast<Terrain*>(created);
     
    236233
    237234  Playable* playable;
    238   const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    239   if (playableList != NULL && !playableList->empty())
     235  if (!Playable::objectList().empty())
    240236  {
    241237    /// TODO Make this also loadable
    242     playable = dynamic_cast<Playable*>(playableList->front());
    243     this->localPlayer->setPlayable(playable);
     238    this->localPlayer->setPlayable(Playable::objectList().front());
    244239  }
    245240
     
    280275  GraphicsEngine::getInstance()->displayFPS(false);
    281276  // 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;
    284277  //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     }
     278  while (!PNode::objectList().empty())
     279    delete PNode::objectList().front();
     280
    294281  /* remove the player object */
    295282  if( this->localPlayer)
     
    302289  this->terrain = NULL;
    303290
    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();
     291  while (!GraphicsEffect::objectList().empty())
     292    delete GraphicsEffect::objectList().front();
     293
     294
     295  while (!Element2D::objectList().empty())
     296    delete Element2D::objectList().front();
    314297
    315298  // At this Point all the WorldEntites should be unloaded.
     
    318301
    319302  // unload the resources loaded in this Level !!
    320   ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
     303  /// FIXME TODO HACK!!
     304//  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
    321305
    322306  if (State::getObjectManager() == this->objectManager)
     
    395379  {
    396380    PRINTF(3)("Setting Sound Track to %s\n", name.c_str());
    397     std::string oggFile = ResourceManager::getFullName(name);
     381    std::string oggFile = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(name);
    398382    this->music = new OrxSound::OggPlayer(oggFile);
    399383    if (this->localPlayer != NULL)
     
    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::staticClassID()))
    417401    {
    418402      this->gameRule = dynamic_cast<GameRules*>(created);
Note: See TracChangeset for help on using the changeset viewer.