Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6142 in orxonox.OLD for trunk/src/story_entities/network_world.cc


Ignore:
Timestamp:
Dec 16, 2005, 7:13:57 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merge the ObjectManager to the trunk
merged with command:
svn merge -r6082:HEAD objectmanager/ ../trunk/

conflicts resolution was easy this time :)
but specially merged the world to network_world

File:
1 edited

Legend:

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

    r6139 r6142  
    3838#include "shell.h"
    3939
    40 #include "garbage_collector.h"
    4140#include "fast_factory.h"
    4241#include "animation_player.h"
     
    123122  PRINTF(3)("NetworkWorld::~NetworkWorld() - deleting current world\n");
    124123
    125 
    126   // here everything that is alocated by the NetworkWorld is deleted
    127   delete this->entities;
    128   State::setWorldEntityList(NULL);
    129 
    130124  delete this->localPlayer;
    131125
     
    141135  SoundEngine::getInstance()->flushAllSources();
    142136
    143 
     137  if (State::getObjectManager() == &this->objectManager)
     138    State::setObjectManager(NULL);
    144139  // erease everything that is left.
    145140  delete PNode::getNullParent();
     
    180175  this->music = NULL;
    181176  this->shell = NULL;
    182   this->entities = NULL;
    183177  this->localPlayer = NULL;
    184178  this->localCamera = NULL;
     
    214208ErrorMessage NetworkWorld::preLoad()
    215209{
    216   State::setWorldEntityList(this->entities = new tList<WorldEntity>());
     210  State::setObjectManager(&this->objectManager);
    217211  this->cycle = 0;
    218212
     
    233227
    234228  GraphicsEngine::getInstance()->displayFPS(true);
    235 
    236   CDEngine::getInstance()->setEntityList( this->entities);
    237229}
    238230
     
    630622
    631623/**
    632  *  gets the list of entities from the world
    633  * @returns entity list
    634 */
    635 tList<WorldEntity>* NetworkWorld::getEntities()
    636 {
    637   return this->entities;
    638 }
    639 
    640 
    641 /**
    642624 *  this returns the current game time
    643625 * @returns elapsed game time
     
    648630}
    649631
    650 
    651632/**
    652633 *  function to put your own debug stuff into it. it can display informations about
    653634   the current class/procedure
    654635*/
    655 void NetworkWorld::debug()
    656 {
    657   PRINTF(0)("Printing out the List of alive NetworkWorldEntities:\n");
    658   tIterator<WorldEntity>* iterator = this->entities->getIterator();
    659   WorldEntity* entity = iterator->firstElement();
    660   while( entity != NULL)
    661   {
    662     PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName());
    663     entity = iterator->nextElement();
    664   }
    665   delete iterator;
    666 }
     636// void NetworkWorld::debug()
     637// {
     638//   PRINTF(0)("Printing out the List of alive NetworkWorldEntities:\n");
     639//   tIterator<WorldEntity>* iterator = this->entities->getIterator();
     640//   WorldEntity* entity = iterator->firstElement();
     641//   while( entity != NULL)
     642//   {
     643//     PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName());
     644//     entity = iterator->nextElement();
     645//   }
     646//   delete iterator;
     647// }
    667648
    668649
     
    682663    {
    683664      ++this->cycle;
    684       PRINTF(4)("NetworkWorld::mainloop() - number of entities: %i\n", this->entities->getSize());
     665//      PRINTF(4)("NetworkWorld::mainloop() - number of entities: %i\n", this->entities->getSize());
    685666      // Network
    686667      this->synchronize ();
     
    727708}
    728709
     710void NetworkWorld::tick(std::list<WorldEntity*> entityList, float dt)
     711{
     712  std::list<WorldEntity*>::iterator entity;
     713  for (entity = entityList.begin(); entity != entityList.end(); entity++)
     714    (*entity)->tick(dt);
     715
     716}
    729717
    730718/**
     
    763751      this->gameTime += this->dtS;
    764752
    765       tIterator<WorldEntity>* iterator = this->entities->getIterator();
    766       WorldEntity* entity = iterator->firstElement();
    767       while( entity != NULL)
    768         {
    769           entity->tick (this->dtS);
    770           entity = iterator->nextElement();
    771         }
    772       delete iterator;
     753/*      this->tick(this->objectManager.getObjectList(OM_DEAD_TICK), this->dtS);
     754      this->tick(this->objectManager.getObjectList(OM_COMMON), this->dtS);
     755      this->tick(this->objectManager.getObjectList(OM_GROUP_00), this->dtS);*/
     756      this->tick(this->objectManager.getObjectList(OM_GROUP_01), this->dtS);
     757      this->tick(this->objectManager.getObjectList(OM_GROUP_01_PROJ), this->dtS);
    773758
    774759      /* update tick the rest */
     
    780765
    781766      ParticleEngine::getInstance()->tick(this->dtS);
    782       GarbageCollector::getInstance()->tick(this->dtS);
    783767
    784768
     
    805789void NetworkWorld::update()
    806790{
    807   GarbageCollector::getInstance()->update();
    808791  GraphicsEngine::getInstance()->update(this->dtS);
    809792  PNode::getNullParent()->updateNode (this->dtS);
     
    816799void NetworkWorld::collide()
    817800{
    818   CDEngine::getInstance()->checkCollisions();
     801  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_00),
     802                                            this->objectManager.getObjectList(OM_GROUP_01_PROJ));
     803  CDEngine::getInstance()->checkCollisions(this->objectManager.getObjectList(OM_GROUP_01),
     804                                            this->objectManager.getObjectList(OM_COMMON));
    819805}
    820806
     
    846832void NetworkWorld::draw ()
    847833{
    848   /* draw entities */
    849   WorldEntity* entity;
    850   glLoadIdentity();
    851   tIterator<WorldEntity>* iterator = this->entities->getIterator();
    852   entity = iterator->firstElement();
    853   while( entity != NULL )
    854   {
    855     if( entity->isVisible() ) entity->draw();
    856     if( unlikely( this->showBV)) entity->drawBVTree(3, 226);  // to draw the bounding boxes of the objects at level 2 for debug purp
    857     entity = iterator->nextElement();
    858   }
    859   delete iterator;
     834  GraphicsEngine* engine = GraphicsEngine::getInstance();
     835  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON_NOTICK));
     836  engine->draw(State::getObjectManager()->getObjectList(OM_ENVIRON));
     837  engine->draw(State::getObjectManager()->getObjectList(OM_COMMON));
     838  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_00));
     839  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
     840  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
     841
     842//   {
     843//     if( entity->isVisible() ) entity->draw();
     844  //FIXME
     845//     if( unlikely( this->showBV)) entity->drawBVTree(3, 226);  // to draw the bounding boxes of the objects at level 2 for debug purp
     846//     entity = iterator->nextElement();
     847//   }
    860848
    861849  glCallList (objectList);
     
    866854    PNode::getNullParent()->debugDraw(0);
    867855
    868   GraphicsEngine::getInstance()->draw();
     856  engine->draw();
    869857  //TextEngine::getInstance()->draw();
    870858}
     
    876864void NetworkWorld::spawn(WorldEntity* entity)
    877865{
    878   this->entities->add (entity);
     866//   this->entities->add (entity);
    879867  entity->postSpawn ();
    880868}
     
    889877void NetworkWorld::spawn(WorldEntity* entity, Vector* absCoor, Quaternion* absDir)
    890878{
    891   this->entities->add (entity);
     879//   this->entities->add (entity);
    892880
    893881  entity->setAbsCoor (*absCoor);
     
    915903      entity->setRelDir (*relDir);
    916904
    917       this->entities->add (entity);
     905//       this->entities->add (entity);
    918906
    919907      entity->postSpawn ();
Note: See TracChangeset for help on using the changeset viewer.