Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4978 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Aug 10, 2005, 11:58:29 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: minor cleanup of world.cc

Location:
orxonox/trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r4977 r4978  
    7474using namespace std;
    7575
    76 
     76//! This creates a Factory to fabricate a World
    7777CREATE_FACTORY(World);
    7878
     
    9090    This creates a new empty world!
    9191*/
    92 World::World (char* name)
     92World::World (const char* name)
    9393{
    9494  this->path = NULL;
     
    119119  ParticleEngine::getInstance()->debug();
    120120
     121  // here everything that is alocated by the World is deleted
    121122  delete this->entities;
    122123  State::setWorldEntityList(NULL);
    123 //  delete NullParent::getInstance();
    124 
    125124
    126125  delete LightManager::getInstance();
    127126  delete TrackManager::getInstance();
    128127  delete ParticleEngine::getInstance();
    129 
     128  delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
     129  delete PhysicsEngine::getInstance();
     130
     131  // external engines initialized by the orxonox-class get deleted
    130132  TextEngine::getInstance()->flush();
    131133  SoundEngine::getInstance()->flushAllBuffers();
    132134  SoundEngine::getInstance()->flushAllSources();
    133 
    134   delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
    135   delete PhysicsEngine::getInstance();
    136   //delete garbagecollecor
    137   //delete animator
    138 
    139135  FastFactory::flushAll();
     136
     137  // erease everything that is left.
    140138  delete NullParent::getInstance();
    141   EventHandler::getInstance()->debug();
    142 
    143   LoadClassDescription::printAll();
    144 
    145 
     139
     140
     141  // unload the resources !!
    146142  ResourceManager::getInstance()->unload(this->music);
    147143  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
     
    149145
    150146/**
    151  *  initializes the world.
    152 
    153    set all stuff here that is world generic and does not use to much memory
    154    because the real init() function StoryEntity::init() will be called
    155    shortly before start of the game.
    156    since all worlds are initiated/referenced before they will be started.
    157    NO LEVEL LOADING HERE - NEVER!
    158 */
    159 void World::constuctorInit(char* name, int worldID)
     147 * initializes the world.
     148 * @param name the name of the world
     149 * @param worldID the ID of this world
     150 *
     151 * set all stuff here that is world generic and does not use to much memory
     152 * because the real init() function StoryEntity::init() will be called
     153 * shortly before start of the game.
     154 * since all worlds are initiated/referenced before they will be started.
     155 * NO LEVEL LOADING HERE - NEVER!
     156*/
     157void World::constuctorInit(const char* name, int worldID)
    160158{
    161159  this->setClassID(CL_WORLD, "World");
    162160
    163   //this->worldName = name;
    164   //this->worldName = new char[strlen(name)+1];
    165   //strcpy(this->worldName, name);
     161  this->setName(name);
    166162  this->debugWorldNr = worldID;
    167163
     
    169165}
    170166
     167/**
     168 * loads the parameters of a World from an XML-element
     169 * @param root the XML-element to load from
     170 */
    171171void World::loadParams(const TiXmlElement* root)
    172172{
    173   const char *string;
    174   char *name;
    175   int id;
    176 
    177173  PRINTF(4)("Creating a World\n");
    178174
     
    187183}
    188184
    189 
    190 /**
    191  *  this is executed before load
    192 
    193    since the load function sometimes needs data, that has been init before
    194    the load and after the proceeding storyentity has finished
     185/**
     186 * this is executed just before load
     187 *
     188 * since the load function sometimes needs data, that has been initialized
     189 * before the load and after the proceeding storyentity has finished
    195190*/
    196191ErrorMessage World::preLoad()
     
    199194  this->cycle = 0;
    200195
    201 
    202196  /* init the world interface */
    203197
    204198  LightManager::getInstance();
    205   this->nullParent = NullParent::getInstance ();
    206   this->nullParent->setName ("NullParent");
     199  NullParent::getInstance ();
    207200
    208201  AnimationPlayer::getInstance(); // initializes the animationPlayer
     
    210203
    211204  this->localCamera = new Camera();
    212   this->localCamera->setName ("Camera");
     205  this->localCamera->setName ("World-Camera");
    213206
    214207  State::setCamera(this->localCamera, this->localCamera->getTarget());
     
    268261      temp = new char[strlen(string + 2)];
    269262      strcpy( temp, string);
    270       this->worldName = temp;
     263      this->setName(temp);
    271264    }
    272265  else
     
    274267      temp = new char[strlen(string + 2)];
    275268      strcpy( temp, string);
    276       this->worldName = temp;
    277     }
     269      this->setName(temp);
     270    }
     271
    278272  ////////////////
    279273  // LOADSCREEN //
     
    376370
    377371
    378 //   lightMan->setAmbientColor(.1,.1,.1);
    379 //   lightMan->addLight();
    380 //   //      lightMan->setAttenuation(1.0, .01, 0.0);
    381 //   //      lightMan->setDiffuseColor(1,1,1);
    382 //   //  lightMan->addLight(1);
    383 //   //  lightMan->setPosition(20, 10, -20);
    384 //   //  lightMan->setDiffuseColor(0,0,0);
    385 //   //lightMan->debug();
    386 //   lightMan->setPosition(-5.0, 50.0, -40.0);
    387 //   lightMan->addLight();
    388 //   lightMan->setPosition(100, 80, 60);
    389 
    390372  //        TrackManager::getInstance()->setBindSlave(env);
    391373  PNode* tn = TrackManager::getInstance()->getTrackNode();
     
    415397
    416398
    417 
    418399  ////////////
    419400  // STATIC //
     
    454435  PhysicsEngine::getInstance()->debug();
    455436
     437
     438
    456439  for(int i = 0; i < 100; i++)
    457440  {
     
    474457
    475458/**
    476  *  loads the debug world: only for experimental stuff
     459 * creates a debug world: only for experimental stuff
    477460*/
    478461void World::loadDebugWorld(int worldID)
     
    637620}
    638621
    639 
    640 
    641622/**
    642623 *  initializes a new World shortly before start
    643 
    644    this is the function, that will be loaded shortly before the world is
    645    started
     624 *
     625 * this is the function, that will be loaded shortly before the world is
     626 * started
    646627*/
    647628ErrorMessage World::init()
     
    899880{
    900881  GarbageCollector::getInstance()->update();
    901   this->nullParent->update (this->dtS);
     882  NullParent::getInstance()->update (this->dtS);
    902883
    903884  SoundEngine::getInstance()->update();
    904   music->update();
     885  //music->update();
    905886}
    906887
     
    998979                  Vector* relCoor, Quaternion* relDir)
    999980{
    1000   this->nullParent = NullParent::getInstance();
     981  NullParent::getInstance();
    1001982  if( parentNode != NULL)
    1002983    {
  • orxonox/trunk/src/story_entities/world.h

    r4977 r4978  
    3434
    3535 public:
    36   World (char* name);
     36  World (const char* name);
    3737  World (int worldID);
    3838  World (const TiXmlElement* root = NULL);
     
    7474
    7575 private:
    76   void constuctorInit(char* name, int worldID);
     76  void constuctorInit(const char* name, int worldID);
    7777
    7878  Uint32 lastFrame;                   //!< last time of frame
     
    8787  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    8888
    89   char* worldName;                    //!< The name of this World
    9089  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
    9190  char* path;                         //!< The file from which this world is loaded
     
    9594
    9695  // IMPORTANT WORLD-ENTITIES
    97   PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
    9896  Camera* localCamera;                //!< The current Camera
    9997  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
Note: See TracChangeset for help on using the changeset viewer.