Changeset 6120 in orxonox.OLD for branches/objectmanager
- Timestamp:
- Dec 15, 2005, 12:42:30 AM (19 years ago)
- Location:
- branches/objectmanager/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/objectmanager/src/story_entities/world.cc
r6074 r6120 141 141 SoundEngine::getInstance()->flushAllSources(); 142 142 143 143 delete ObjectManager::getInstance(); 144 144 // erease everything that is left. 145 145 delete PNode::getNullParent(); -
branches/objectmanager/src/util/object_manager.cc
r6119 r6120 27 27 28 28 /** 29 * standard constructor29 * @brief standard constructor 30 30 */ 31 31 ObjectManager::ObjectManager () … … 43 43 44 44 /** 45 @brief standard deconstructor 45 * @brief standard deconstructor 46 * 47 * this also removes ALL entitites in existence. 46 48 */ 47 49 ObjectManager::~ObjectManager () 48 50 { 51 this->flush(); 49 52 ObjectManager::singletonRef = NULL; 53 } 54 55 /** 56 * @brief flushes all entities 57 * 58 * this function deletes all entities that exist within the ObjectManager. 59 * It does this by poping each list from the front, and delete the given object. 60 * 61 * automatically called by a destructor. 62 */ 63 void ObjectManager::flush() 64 { 65 for (unsigned int i = 0; i < OM_SIZE; ++i) 66 while(!this->objectLists[i].empty()) 67 delete this->objectLists[i].front(); 50 68 } 51 69 … … 112 130 void ObjectManager::debug(OM_LIST omList) const 113 131 { 114 if (omList != OM_INIT )132 if (omList != OM_INIT || omList == OM_SIZE) 115 133 { 116 PRINT(0)(" +ObjectManager-LIST: '%s'- -----\n", ObjectManager::OMListToString((OM_LIST) omList));134 PRINT(0)(" +ObjectManager-LIST: '%s'-size='%d'-----\n", ObjectManager::OMListToString((OM_LIST) omList), this->objectLists[omList].size()); 117 135 std::list<WorldEntity*>::const_iterator entity; 118 136 for (entity = this->objectLists[omList].begin(); entity != this->objectLists[omList].end(); entity++) … … 150 168 const char* ObjectManager::OMListToString(OM_LIST omList) 151 169 { 170 if (omList == OM_INIT || omList == OM_SIZE) 171 return "===invalid==="; 172 152 173 return ObjectManager::objectManagerListNames[omList]; 153 174 } -
branches/objectmanager/src/util/object_manager.h
r6119 r6120 73 73 inline static ObjectManager* getInstance(void) { if (!ObjectManager::singletonRef) ObjectManager::singletonRef = new ObjectManager(); return ObjectManager::singletonRef; } 74 74 75 void flush(); 75 76 76 77 void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST);
Note: See TracChangeset
for help on using the changeset viewer.