Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4289 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 26, 2005, 12:49:50 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now all unused projectiles are added to the dead list and not deleted anymore

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/garbage_collector.cc

    r4262 r4289  
    2525
    2626#include "list.h"
     27#include "object_manager.h"
    2728
    2829using namespace std;
     
    137138          entity->remove();
    138139          /* then finaly delete reference */
    139           delete entity;
     140          //delete entity;
     141          ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity);
     142          ObjectManager::getInstance()->debug();
    140143        }
    141144      entity = iterator->nextElement();
  • orxonox/trunk/src/util/object_manager.cc

    r4288 r4289  
    7878    this->managedObjectList[index]->add(object);
    7979  else
    80     PRINTF(0)(" Error: unable to add object to the list nr. %i, ignoring\n", index);
     80    PRINTF(0)(" Error: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
    8181}
    8282
    8383
    8484BaseObject* ObjectManager::getFromDeadList(classList index, int number)
    85 {}
     85{
     86  if( likely(this->managedObjectList[index] != NULL))
     87    {
     88      BaseObject* obj = this->managedObjectList[index]->firstElement();
     89      this->managedObjectList[index]->remove(obj);
     90      return obj;
     91    }
     92  else
     93    PRINTF(0)(" Error: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
     94}
    8695
    8796
  • orxonox/trunk/src/world_entities/player.cc

    r4287 r4289  
    106106  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
    107107  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
    108 
    109   BaseObject* p = new Projectile(wpRight);
    110   ObjectManager::getInstance()->cache(CL_PROJECTILE, 100, *p);
    111   ObjectManager::getInstance()->debug();
    112 
    113108}
    114109
  • orxonox/trunk/src/world_entities/test_gun.cc

    r4287 r4289  
    3232#include "animation3d.h"
    3333
     34#include "object_manager.h"
    3435
    3536using namespace std;
     
    8889    }
    8990
     91  BaseObject* p = new TestBullet(this);
     92  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, *p);
     93  ObjectManager::getInstance()->debug();
    9094}
    9195
Note: See TracChangeset for help on using the changeset viewer.