Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4332 in orxonox.OLD for orxonox/branches/physics/src/util


Ignore:
Timestamp:
May 27, 2005, 7:14:55 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the trunk back to the physics-branche
merged with command:
svn merge -r 4301:HEAD trunk/ branches/physics/
little conflict in particle-system resolved easily

Location:
orxonox/branches/physics/src/util
Files:
9 edited
7 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/util/animation/animation_player.cc

    r3953 r4332  
    2828AnimationPlayer::AnimationPlayer ()
    2929{
    30    this->setClassName ("AnimationPlayer");
     30   this->setClassID(CL_ANIMATION_PLAYER, "AnimationPlayer");
    3131
    3232   this->animationList = new tList<Animation>();
  • orxonox/branches/physics/src/util/garbage_collector.cc

    r4301 r4332  
    3838GarbageCollector::GarbageCollector ()
    3939{
    40    this->setClassName ("GarbageCollection");
     40   this->setClassID(CL_GARBAGE_COLLECTOR, "GarbageCollector");
    4141   this->time = 0;
    4242   this->delay = 1.5f; /* clean up all 5.0 seconds */
     
    139139          /* then finaly delete reference */
    140140          //delete entity;
    141           ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity);
    142           ObjectManager::getInstance()->debug();
     141          ObjectManager::getInstance()->addToDeadList(entity->getClassID(), entity);
    143142        }
    144143      entity = iterator->nextElement();
     
    148147  PRINTF(3)("=============================\n");
    149148
     149  ObjectManager::getInstance()->debug();
     150
    150151  /* reset time to count again up to this->delay */
    151152  this->time = 0;
  • orxonox/branches/physics/src/util/loading/game_loader.cc

    r4283 r4332  
    8282      delete campaignName;
    8383    }
     84  World* world0 = new World(DEBUG_WORLD_0);
     85  world0->setNextStoryID(WORLD_ID_GAMEEND);
     86  this->currentCampaign->addEntity(world0, WORLD_ID_2);
    8487}
    8588
  • orxonox/branches/physics/src/util/loading/load_param.h

    r4301 r4332  
    180180  static LoadClassDescription* addClass(const char* className);
    181181  LoadParamDescription* addParam(const char* paramName);
     182 
    182183
    183184  static void printAll(const char* fileName = NULL);
  • orxonox/branches/physics/src/util/object_manager.cc

    r4301 r4332  
    2828ObjectManager::ObjectManager ()
    2929{
    30   this->setClassName ("ObjectManager");
     30  this->setClassID(CL_OBJECT_MANAGER, "ObjectManager");
    3131 
    32   //this->managedObjectList = new BaseObject*[CL_NUMBER];
    3332  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
     33  for(int i = 0; i < CL_NUMBER; ++i)
     34    {
     35      this->managedObjectList[i] = NULL;
     36    }
    3437
    3538  this->garbageCollector = GarbageCollector::getInstance();
    3639}
     40
    3741
    3842/**
     
    6266
    6367
    64 void ObjectManager::cache(classList index, int number, const BaseObject &copyObject)
    65 {
    66   //this->managedObjectList[index] = new BaseObject[number];
    67   this->managedObjectList[index] = new tList<BaseObject>();
    68   for(int i = 0; i < number; ++i)
    69     {
    70       this->managedObjectList[index]->add(new BaseObject(copyObject));
    71     }
    72 }
    73 
    74 
    75 void ObjectManager::addToDeadList(classList index, BaseObject* object)
     68void ObjectManager::addToDeadList(int index, BaseObject* object)
    7669{
    7770  if( likely(this->managedObjectList[index] != NULL))
    7871    this->managedObjectList[index]->add(object);
    7972  else
    80     PRINTF(0)(" Error: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
     73    PRINTF(0)(" Critical: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
    8174}
    8275
    8376
    84 BaseObject* ObjectManager::getFromDeadList(classList index, int number)
     77BaseObject* ObjectManager::getFromDeadList(int index, int number)
    8578{
    8679  if( likely(this->managedObjectList[index] != NULL))
     
    8881      BaseObject* obj = this->managedObjectList[index]->firstElement();
    8982      this->managedObjectList[index]->remove(obj);
     83      if( unlikely(obj == NULL))
     84        {
     85          PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n");
     86        }
    9087      return obj;
    9188    }
    9289  else
    93     PRINTF(0)(" Error: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
     90    PRINTF(0)(" Critical: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
     91  return NULL;
    9492}
    9593
     
    102100  for(int i = 0; i < CL_NUMBER; ++i)
    103101    {
    104       if(this->managedObjectList[i] != NULL)
     102      if( this->managedObjectList[i] != NULL)
    105103        PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
    106104      else
  • orxonox/branches/physics/src/util/object_manager.h

    r4301 r4332  
    88    - recycle deleted objects: specific for Projectils since there is a lot of world entity creation/deletion (and this needs a lot of time)
    99    - control the garbage collector
     10
     11    TO ADD SUPPORT FOR A CLASS do the following steps:
     12    1. include the hader file : #include "class_header.h"
     13    2. add the class to the type enum classList {}; in class_list.h
     14    3. define a function void mCache( ClassName ) in class ObjectManager
     15
    1016*/
    1117
     
    1521
    1622#include "base_object.h"
    17 
    18 #define OM_
     23#include "projectile.h"
     24#include "list.h"
    1925
    2026#include "class_list.h"
    21 
     27 
    2228
    2329class WorldEntity;
     
    2531
    2632
    27 template<class T> class tList;
    28 template<class T> class ManagedObject;
     33//! This defines the "template" makro function for cache(...)
     34#define mCache( Class ) \
     35 cache(classList index, int number, Class * copyObject)        \
     36{                                                              \
     37  this->managedObjectList[index] = new tList<BaseObject>(); \
     38  for(int i = 0; i < number; ++i)\
     39    {\
     40      this->managedObjectList[index]->add(new Class (*copyObject));\
     41    }\
     42}
     43
     44
    2945
    3046//! the object manager itself
     
    3551  virtual ~ObjectManager(void);
    3652 
    37   void cache(classList index, int number, const BaseObject &copyObject);
    38   void addToDeadList(classList index, BaseObject* object);
    39   BaseObject* getFromDeadList(classList index, int number = 1);
     53  void mCache(Projectile);
     54  void addToDeadList(int index, BaseObject* object);
     55  BaseObject* getFromDeadList(int index, int number = 1);
    4056
    4157  void debug();
     
    4359 private:
    4460  ObjectManager(void);
     61
    4562  static ObjectManager* singletonRef;
    4663
    47   //BaseObject** managedObjectList;
    4864  tList<BaseObject>** managedObjectList;
    4965  GarbageCollector* garbageCollector;
  • orxonox/branches/physics/src/util/resource_manager.cc

    r4295 r4332  
    3838ResourceManager::ResourceManager ()
    3939{
    40    this->setClassName ("ResourceManager");
     40   this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager");
    4141   this->dataDir = NULL;
    4242   this->setDataDir("./");
  • orxonox/branches/physics/src/util/track/track_manager.cc

    r4283 r4332  
    370370TrackManager::TrackManager(void)
    371371{
    372   this->setClassName("TrackManager");
     372  this->setClassID(CL_TRACK_MANAGER, "TrackManager");
    373373 
    374374  TrackManager::singletonRef = this; // do this because otherwise the TrackNode cannot get The instance of the TrackManager
  • orxonox/branches/physics/src/util/track/track_node.cc

    r4283 r4332  
    3232TrackNode::TrackNode ()
    3333{
    34   this->setClassName("TrackNode");
     34  this->setClassID(CL_TRACK_NODE, "TrackNode");
    3535  this->setName("TrackNode"); /* absolete but still used... */
    3636
Note: See TracChangeset for help on using the changeset viewer.