Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6134 in orxonox.OLD for branches/objectmanager/src/story_entities


Ignore:
Timestamp:
Dec 16, 2005, 5:16:00 PM (19 years ago)
Author:
bensch
Message:

om: disected the old worldEntity list out.
removed GarbageCollector
minor updates

Location:
branches/objectmanager/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/objectmanager/src/story_entities/world.cc

    r6126 r6134  
    3838#include "shell.h"
    3939
    40 #include "garbage_collector.h"
    4140#include "fast_factory.h"
    4241#include "animation_player.h"
     
    122121  delete this->shell;
    123122  PRINTF(3)("World::~World() - deleting current world\n");
    124 
    125 
    126   // here everything that is alocated by the World is deleted
    127   delete this->entities;
    128   State::setWorldEntityList(NULL);
    129123
    130124  delete this->localPlayer;
     
    181175  this->music = NULL;
    182176  this->shell = NULL;
    183   this->entities = NULL;
    184177  this->localPlayer = NULL;
    185178  this->localCamera = NULL;
     
    216209{
    217210  State::setObjectManager(&this->objectManager);
    218   State::setWorldEntityList(this->entities = new tList<WorldEntity>());
    219211  this->cycle = 0;
    220212
     
    588580
    589581/**
    590  *  gets the list of entities from the world
    591  * @returns entity list
    592 */
    593 tList<WorldEntity>* World::getEntities()
    594 {
    595   return this->entities;
    596 }
    597 
    598 
    599 /**
    600582 *  this returns the current game time
    601583 * @returns elapsed game time
     
    605587  return this->gameTime;
    606588}
    607 
    608 
    609 /**
    610  *  function to put your own debug stuff into it. it can display informations about
    611    the current class/procedure
    612 */
    613 void World::debug()
    614 {
    615   PRINTF(0)("Printing out the List of alive WorldEntities:\n");
    616   tIterator<WorldEntity>* iterator = this->entities->getIterator();
    617   WorldEntity* entity = iterator->firstElement();
    618   while( entity != NULL)
    619   {
    620     PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName());
    621     entity = iterator->nextElement();
    622   }
    623   delete iterator;
    624 }
    625 
    626589
    627590/**
     
    640603    {
    641604      ++this->cycle;
    642       PRINTF(4)("World::mainloop() - number of entities: %i\n", this->entities->getSize());
    643605      // Network
    644606      this->synchronize ();
     
    685647}
    686648
     649void World::tick(std::list<WorldEntity*> entityList, float dt)
     650{
     651  std::list<WorldEntity*>::iterator entity;
     652  for (entity = entityList.begin(); entity != entityList.end(); entity++)
     653    (*entity)->tick(dt);
     654
     655}
    687656
    688657/**
     
    721690      this->gameTime += this->dtS;
    722691
    723 
    724       tIterator<WorldEntity>* iterator = this->entities->getIterator();
    725       WorldEntity* entity = iterator->firstElement();
    726       while( entity != NULL)
    727         {
    728           entity->tick (this->dtS);
    729           entity = iterator->nextElement();
    730         }
    731       delete iterator;
     692      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
     693      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
     694      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);
     695      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
     696      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
     697
     698//       tIterator<WorldEntity>* iterator = this->entities->getIterator();
     699//       WorldEntity* entity = iterator->firstElement();
     700//       while( entity != NULL)
     701//         {
     702//           entity->tick (this->dtS);
     703//           entity = iterator->nextElement();
     704//         }
     705//       delete iterator;
    732706
    733707      /* update tick the rest */
     
    739713
    740714      ParticleEngine::getInstance()->tick(this->dtS);
    741       GarbageCollector::getInstance()->tick(this->dtS);
    742715
    743716
     
    764737void World::update()
    765738{
    766   GarbageCollector::getInstance()->update();
    767739  GraphicsEngine::getInstance()->update(this->dtS);
    768740  PNode::getNullParent()->updateNode (this->dtS);
     
    813785  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
    814786  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
    815  
    816  
    817   /* draw entities */
    818   WorldEntity* entity;
    819   glLoadIdentity();
    820   tIterator<WorldEntity>* iterator = this->entities->getIterator();
    821   entity = iterator->firstElement();
    822   while( entity != NULL )
    823   {
    824     if( entity->isVisible() ) entity->draw();
    825     if( unlikely( this->showBV)) entity->drawBVTree(3, 226);  // to draw the bounding boxes of the objects at level 2 for debug purp
    826     entity = iterator->nextElement();
    827   }
    828   delete iterator;
     787
     788//   {
     789//     if( entity->isVisible() ) entity->draw();
     790  //FIXME
     791//     if( unlikely( this->showBV)) entity->drawBVTree(3, 226);  // to draw the bounding boxes of the objects at level 2 for debug purp
     792//     entity = iterator->nextElement();
     793//   }
    829794
    830795  glCallList (objectList);
     
    845810void World::spawn(WorldEntity* entity)
    846811{
    847   this->entities->add (entity);
     812//   this->entities->add (entity);
    848813  entity->postSpawn ();
    849814}
     
    858823void World::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir)
    859824{
    860   this->entities->add (entity);
     825//   this->entities->add (entity);
    861826
    862827  entity->setAbsCoor (*absCoor);
     
    884849      entity->setRelDir (*relDir);
    885850
    886       this->entities->add (entity);
     851//       this->entities->add (entity);
    887852
    888853      entity->postSpawn ();
  • branches/objectmanager/src/story_entities/world.h

    r6121 r6134  
    2323class Shell;
    2424class OggPlayer;
    25 
    26 template<class T> class tList;
    2725
    2826//! The game world
     
    6159  bool command (Command* cmd);
    6260
    63   tList<WorldEntity>* getEntities();
    64 
    6561  /* interface to world */
    6662  void spawn (WorldEntity* entity);
     
    8480  void synchronize ();
    8581  void handleInput ();
     82  void tick (std::list<WorldEntity*> worldEntity, float dt);
    8683  void tick ();
    8784  void update ();
     
    120117
    121118    GLuint objectList;                  //!< temporary: @todo this will be ereased soon
    122     tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
     119
    123120    Player* localPlayer;                //!< The Player, you fly through the level.
    124121};
Note: See TracChangeset for help on using the changeset viewer.