Changeset 9798 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Sep 24, 2006, 11:55:20 AM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/new_resource_manager.cc
r9797 r9798 49 49 //this->unloadAllByPriority(RP_GAME); 50 50 51 // if (!this->resourceList.empty())52 // PRINTF(1)("Not removed all Resources, since there are still %d resources registered\n", this->resourceList.size());51 // if (!this->resourceList.empty()) 52 // PRINTF(1)("Not removed all Resources, since there are still %d resources registered\n", this->resourceList.size()); 53 53 54 54 NewResourceManager::_singletonRef = NULL; … … 110 110 111 111 112 113 unsigned int NewResourceManager::addKeepLevelName(const std::string& keepLevelName) 114 { 115 this->_keepLevelNames.push_back(keepLevelName); 116 return _keepLevelNames.size()-1; 117 } 118 119 unsigned int NewResourceManager::getKeepLevelID(const std::string& keepLevelName) const 120 { 121 for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i) 122 if (this->_keepLevelNames[i] == keepLevelName) 123 return i; 124 125 PRINTF(2)("KeepLevel '%s' not found. Using 0 instead\n", keepLevelName.c_str()); 126 return 0; 127 } 128 129 const std::string& NewResourceManager::getKeepLevelID(unsigned int keepLevelID) const 130 { 131 assert(keepLevelID < this->_keepLevelNames.size()); 132 return this->_keepLevelNames[keepLevelID]; 133 } 134 135 112 136 /** 113 137 * @brief outputs debug information about the NewResourceManager … … 118 142 PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n"); 119 143 PRINT(0)("======================================\n"); 120 PRINT(0)("Listing %d Types: \n", this->_resourceTypes.size()); 144 PRINT(0)(" MainGlobal search path is %s\n", this->_mainGlobalPath.name().c_str()); 145 if(!this->_globalPaths.empty()) 146 { 147 PRINT(0)(" Additional Global search Paths are: "); 148 for (unsigned int i = 0; i < this->_globalPaths.size(); ++i) 149 PRINT(0)("'%s' ", this->_globalPaths[i].name().c_str()); 150 PRINT(0)("\n"); 151 } 152 PRINT(0)(" Listing %d Types: \n", this->_resourceTypes.size()); 121 153 std::vector<Resources::Type*>::const_iterator it; 122 154 for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it) … … 127 159 } 128 160 161 PRINT(0)("KeepLevels are: "); 162 for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i) 163 PRINT(0)("%d:'%s' ", i, this->_keepLevelNames[i].c_str()); 164 PRINT(0)("\n"); 129 165 PRINT(0)("==================================RM==\n"); 130 166 } -
branches/new_class_id/src/lib/util/loading/new_resource_manager.h
r9797 r9798 26 26 void registerType(Resources::Type* type); 27 27 28 void addKeepLevel(unsigned int i, const std::string& keepLevel); 28 unsigned int addKeepLevelName(const std::string& keepLevelName); 29 unsigned int getKeepLevelID(const std::string& keepLevelName) const; 30 const std::string& getKeepLevelID(unsigned int keepLevelID) const; 29 31 30 32 const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; }; … … 55 57 std::vector<Directory> _globalPaths; 56 58 57 std::vector< Resources::KeepLevel> _keepLevels;59 std::vector<std::string> _keepLevelNames; 58 60 }; 59 61 -
branches/new_class_id/src/lib/util/loading/resource.cc
r9795 r9798 109 109 //// KEEPLEVEL //// 110 110 /////////////////// 111 std::vector<std::string> Resources::KeepLevel::_keepLevelNames; 112 void Resources::KeepLevel::defineKeepLevelName(unsigned int level, const std::string& name) 111 Resources::KeepLevel::KeepLevel(const std::string& keepLevelName) 113 112 { 114 if (_keepLevelNames.size() <= level) 115 _keepLevelNames.resize(level+1); 116 _keepLevelNames[level] = name; 113 this->_keepLevel = NewResourceManager::getInstance()->getKeepLevelID(keepLevelName); 117 114 } 115 118 116 119 117 -
branches/new_class_id/src/lib/util/loading/resource.h
r9793 r9798 22 22 KeepLevel(const std::string& keepLevelName); 23 23 24 static void defineKeepLevelName(unsigned int level, const std::string& name);24 unsigned int keepLevel() const { return _keepLevel; }; 25 25 private: 26 26 unsigned int _keepLevel; 27 private:28 static std::vector<std::string> _keepLevelNames;29 27 }; 30 28 -
branches/new_class_id/src/orxonox.cc
r9797 r9798 370 370 NewResourceManager::getInstance()->addResourceSubPath("Texture", "pictures"); 371 371 372 NewResourceManager::getInstance()->addKeepLevelName("Imediately"); 373 NewResourceManager::getInstance()->addKeepLevelName("LevelEnd"); 374 NewResourceManager::getInstance()->addKeepLevelName("CampaignEnd"); 375 NewResourceManager::getInstance()->addKeepLevelName("GameEnd"); 376 377 372 378 NewResourceManager::getInstance()->debug(); 373 379 // DynamicLoader::loadDyLib("libtest.so");
Note: See TracChangeset
for help on using the changeset viewer.