mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 14:56:38 +00:00 
			
		
		
		
	fix for more than 10 game files; delete both master and plugin settings if called with --game-files
This commit is contained in:
		
							parent
							
								
									1d596d6c72
								
							
						
					
					
						commit
						a2a7539fd5
					
				
					 2 changed files with 20 additions and 17 deletions
				
			
		|  | @ -6,6 +6,7 @@ | |||
| #include <map> | ||||
| #include <vector> | ||||
| #include <algorithm> | ||||
| #include <sstream> | ||||
| 
 | ||||
| MwIniImporter::MwIniImporter() { | ||||
|     const char *map[][2] = | ||||
|  | @ -23,6 +24,12 @@ void MwIniImporter::setVerbose(bool verbose) { | |||
|     mVerbose = verbose; | ||||
| } | ||||
| 
 | ||||
| std::string MwIniImporter::numberToString(int n) { | ||||
|     std::stringstream str; | ||||
|     str << n; | ||||
|     return str.str(); | ||||
| } | ||||
| 
 | ||||
| MwIniImporter::multistrmap MwIniImporter::loadIniFile(std::string filename) { | ||||
|     std::cout << "load ini file: " << filename << std::endl; | ||||
|      | ||||
|  | @ -130,7 +137,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { | |||
|     multistrmap::iterator it = ini.begin(); | ||||
|     for(int i=0; it != ini.end(); i++) { | ||||
|         gameFile = baseGameFile; | ||||
|         gameFile.append(1,i+'0'); | ||||
|         gameFile.append(this->numberToString(i)); | ||||
|          | ||||
|         it = ini.find(gameFile); | ||||
|         if(it == ini.end()) { | ||||
|  | @ -152,24 +159,19 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { | |||
|         gameFile = ""; | ||||
|     } | ||||
|      | ||||
|     if(!esmFiles.empty()) { | ||||
|         multistrmap::iterator it; | ||||
|         cfg.erase("master"); | ||||
|         cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) ); | ||||
|          | ||||
|         for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) { | ||||
|             cfg["master"].push_back(*it); | ||||
|         } | ||||
|     multistrmap::iterator it; | ||||
|     cfg.erase("master"); | ||||
|     cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) ); | ||||
|      | ||||
|     for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) { | ||||
|         cfg["master"].push_back(*it); | ||||
|     } | ||||
|      | ||||
|     if(!espFiles.empty()) { | ||||
|         multistrmap::iterator it; | ||||
|         cfg.erase("plugin"); | ||||
|         cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) ); | ||||
|          | ||||
|         for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { | ||||
|             cfg["plugin"].push_back(*it); | ||||
|         } | ||||
|     cfg.erase("plugin"); | ||||
|     cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) ); | ||||
|      | ||||
|     for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { | ||||
|         cfg["plugin"].push_back(*it); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ class MwIniImporter { | |||
|      | ||||
|   private: | ||||
|     bool specialMerge(std::string cfgKey, std::string iniKey, multistrmap &cfg, multistrmap &ini); | ||||
|     std::string numberToString(int n); | ||||
|     bool mVerbose; | ||||
|     strmap mMergeMap; | ||||
| }; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue