Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6134 in orxonox.OLD for branches/objectmanager


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
Files:
2 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • branches/objectmanager/src/orxonox.cc

    r6079 r6134  
    4343#include "text_engine.h"
    4444#include "event_handler.h"
    45 #include "garbage_collector.h"
    4645
    4746#include "factory.h"
     
    9695  // game-specific
    9796  delete GameLoader::getInstance();
    98   delete GarbageCollector::getInstance();
    9997
    10098  // class-less services/factories
  • 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};
  • branches/objectmanager/src/util/Makefile.am

    r5750 r6134  
    77                        object_manager.cc \
    88                        loading/factory.cc \
    9                         garbage_collector.cc \
    109                        state.cc \
    1110                        user_control.cc \
     
    1918                        track/pilot_node.cc \
    2019                        track/track_manager.cc \
    21                         track/track_node.cc 
     20                        track/track_node.cc
    2221
    2322noinst_HEADERS =        fast_factory.h \
    2423                        object_manager.h \
    25                         garbage_collector.h \
    2624                        state.h \
    2725                        user_control.h \
  • branches/objectmanager/src/util/state.cc

    r6121 r6134  
    3030
    3131ObjectManager* State::objectManager = NULL;
    32 tList<WorldEntity>* State::worldEntityList = NULL;
    3332
    3433/**
  • branches/objectmanager/src/util/state.h

    r6121 r6134  
    1010class PNode;
    1111class WorldEntity;
    12 template<class T> class tList;
    1312class ObjectManager;
    1413
     
    4342  /// WORLD_ENTITY_LIST ///
    4443  /////////////////////////
    45   /** @param worldEntityList The World's List of WorldEntities */
    46   static inline void setWorldEntityList(tList<WorldEntity>* worldEntityList) { State::worldEntityList = worldEntityList; };
    47   /** @returns the List of WorldEntities */
    48   static inline tList<WorldEntity>* getWorldEntityList() { return State::worldEntityList; };
    4944
    5045 private:
     
    5651  static ObjectManager*         objectManager;      //!< A referenct to the current ObjectManager
    5752
    58   static tList<WorldEntity>*    worldEntityList;    //!< The List of the worldEntities
    59 
    60   //tStack<
    6153};
    6254
  • branches/objectmanager/src/world_entities/npcs/npc.cc

    r6121 r6134  
    5050      WorldEntity* powerUp = new TurretPowerUp();
    5151      powerUp->setAbsCoor(this->getAbsCoor());
    52       State::getWorldEntityList()->add(powerUp);
     52      powerUp->toList(OM_COMMON);
    5353    }
    5454    else if ((float)rand()/RAND_MAX < .3)
     
    5656      WorldEntity* powerUp = new LaserPowerUp();
    5757      powerUp->setAbsCoor(this->getAbsCoor());
    58       State::getWorldEntityList()->add(powerUp);
     58      powerUp->toList(OM_COMMON);
    5959    }
    60     State::getWorldEntityList()->remove(this);
     60    this->toList(OM_DEAD);
    6161    this->removeNode();
    6262
     
    6868  {
    6969    this->setVisibiliy(false);
    70     State::getWorldEntityList()->remove(this);
     70    this->toList(OM_DEAD);
    7171    this->removeNode();
    7272  }
  • branches/objectmanager/src/world_entities/power_ups/laser_power_up.cc

    r5994 r6134  
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    8181 if (entity->isA(CL_PLAYABLE))
    82   State::getWorldEntityList()->remove(this);
     82  this->toList(OM_DEAD);
    8383}
    8484
  • branches/objectmanager/src/world_entities/power_ups/turret_power_up.cc

    r5994 r6134  
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    8181 if (entity->isA(CL_PLAYABLE))
    82   State::getWorldEntityList()->remove(this);
     82   this->toList(OM_DEAD);
    8383}
    8484
  • branches/objectmanager/src/world_entities/test_entity.cc

    r6122 r6134  
    7171    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    7272  this->setVisibiliy(false);
    73   State::getWorldEntityList()->remove(this);
     73  this->toList(OM_DEAD);
    7474  }
    7575}
  • branches/objectmanager/src/world_entities/weapons/aim.cc

    r6078 r6134  
    104104void Aim::searchTarget(float range)
    105105{
    106   tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
     106  //FIXME//
     107/*  tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
    107108  WorldEntity* entity = iterator->firstElement();
    108109  while (likely(entity != NULL))
     
    121122  }
    122123
    123   delete iterator;
     124  delete iterator;*/
    124125}
    125126
  • branches/objectmanager/src/world_entities/weapons/bomb.cc

    r6123 r6134  
    174174void Bomb::activate()
    175175{
    176   State::getWorldEntityList()->add(this);
    177176
    178177}
     
    180179void Bomb::deactivate()
    181180{
    182   this->toList(OM_NULL);
    183   State::getWorldEntityList()->remove(this);
     181  this->toList(OM_DEAD);
    184182  this->lifeCycle = 0.0f;
    185183  Bomb::fastFactory->kill(this);
  • branches/objectmanager/src/world_entities/weapons/guided_missile.cc

    r6126 r6134  
    8585void GuidedMissile::activate()
    8686{
    87   State::getWorldEntityList()->add(this);
    8887  if (unlikely(GuidedMissile::trailParticles == NULL))
    8988  {
     
    129128  this->lifeCycle = 0.0;
    130129
    131   this->toList(OM_NULL);
    132 //  GarbageCollector::getInstance()->collect(this);
    133   State::getWorldEntityList()->remove(this);
     130  this->toList(OM_DEAD);
    134131  this->removeNode();
    135132  GuidedMissile::fastFactory->kill(this);
  • branches/objectmanager/src/world_entities/weapons/laser.cc

    r6123 r6134  
    7777void Laser::activate()
    7878{
    79   State::getWorldEntityList()->add(this);
    8079  if (unlikely(Laser::explosionParticles == NULL))
    8180  {
     
    9998  this->toList(OM_NULL);
    10099
    101   State::getWorldEntityList()->remove(this);
     100  this->toList(OM_DEAD);
    102101  this->removeNode();
    103102  Laser::fastFactory->kill(this);
  • branches/objectmanager/src/world_entities/weapons/projectile.cc

    r6078 r6134  
    2222#include "weapon.h"
    2323#include "model.h"
    24 
    25 #include "garbage_collector.h"
    2624
    2725using namespace std;
  • branches/objectmanager/src/world_entities/weapons/rocket.cc

    r6123 r6134  
    8282void Rocket::activate()
    8383{
    84   State::getWorldEntityList()->add(this);
    8584  if (unlikely(Rocket::trailParticles == NULL))
    8685  {
     
    128127
    129128//  GarbageCollector::getInstance()->collect(this);
    130   State::getWorldEntityList()->remove(this);
     129  this->toList(OM_DEAD);
    131130  Rocket::fastFactory->kill(this);
    132131}
  • branches/objectmanager/src/world_entities/weapons/test_bullet.cc

    r6123 r6134  
    8282void TestBullet::activate()
    8383{
    84   State::getWorldEntityList()->add(this);
    8584  if (unlikely(TestBullet::trailParticles == NULL))
    8685  {
     
    121120  this->toList(OM_NULL);
    122121
    123 //  GarbageCollector::getInstance()->collect(this);
    124   State::getWorldEntityList()->remove(this);
    125122  TestBullet::fastFactory->kill(this);
    126123}
Note: See TracChangeset for help on using the changeset viewer.