Changeset 4311 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 26, 2005, 11:03:31 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/garbage_collector.cc
r4289 r4311 140 140 //delete entity; 141 141 ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity); 142 ObjectManager::getInstance()->debug();143 142 } 144 143 entity = iterator->nextElement(); … … 148 147 PRINTF(3)("=============================\n"); 149 148 149 ObjectManager::getInstance()->debug(); 150 150 151 /* reset time to count again up to this->delay */ 151 152 this->time = 0; -
orxonox/trunk/src/util/object_manager.cc
r4289 r4311 19 19 #include "list.h" 20 20 21 #include "projectile.h" 21 22 22 23 using namespace std; … … 62 63 63 64 64 void ObjectManager::cache(classList index, int number, const BaseObject ©Object)65 void ObjectManager::cache(classList index, int number, Projectile* copyObject) 65 66 { 66 67 //this->managedObjectList[index] = new BaseObject[number]; … … 68 69 for(int i = 0; i < number; ++i) 69 70 { 70 this->managedObjectList[index]->add(new BaseObject(copyObject));71 this->managedObjectList[index]->add(new Projectile(*copyObject)); 71 72 } 72 73 } -
orxonox/trunk/src/util/object_manager.h
r4288 r4311 18 18 #define OM_ 19 19 20 #include "class_list.h" 20 21 //! list of all classes to be loadable in via the ObjectManager 22 typedef enum classList 23 { 24 CL_PROJECTILE, 25 CL_TEST_BULLET, 26 27 CL_NUMBER 28 }; 29 30 31 21 32 22 33 23 34 class WorldEntity; 24 35 class GarbageCollector; 25 36 class Projectile; 26 37 27 38 template<class T> class tList; 28 39 template<class T> class ManagedObject; 40 41 #define mCache( Class ) \ 42 cache(classList index, int number, Class * copyObject) 43 44 29 45 30 46 //! the object manager itself … … 35 51 virtual ~ObjectManager(void); 36 52 37 void cache(classList index, int number, const BaseObject ©Object); 53 54 void mCache(Projectile); 55 38 56 void addToDeadList(classList index, BaseObject* object); 39 57 BaseObject* getFromDeadList(classList index, int number = 1); 58 59 40 60 41 61 void debug(); … … 43 63 private: 44 64 ObjectManager(void); 65 //void cache(classList index, int number, Projectile* copyObject); 66 45 67 static ObjectManager* singletonRef; 46 68 -
orxonox/trunk/src/world_entities/test_gun.cc
r4289 r4311 89 89 } 90 90 91 BaseObject* p = new TestBullet(this);92 ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, *p);91 Projectile* p = new TestBullet(this); 92 ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p); 93 93 ObjectManager::getInstance()->debug(); 94 94 } … … 143 143 } 144 144 145 Projectile* pj = new TestBullet(this); 145 Projectile* pj = (TestBullet*)ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET); 146 147 //printf( "object ref %p\n", ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET)); 148 149 //Projectile* pj = new TestBullet(this); 146 150 pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset); 147 151 pj->setAbsDir(this->getAbsDir());
Note: See TracChangeset
for help on using the changeset viewer.