forked from teamnwah/openmw-tes3coop
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 <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
MwIniImporter::MwIniImporter() {
|
MwIniImporter::MwIniImporter() {
|
||||||
const char *map[][2] =
|
const char *map[][2] =
|
||||||
|
@ -23,6 +24,12 @@ void MwIniImporter::setVerbose(bool verbose) {
|
||||||
mVerbose = verbose;
|
mVerbose = verbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MwIniImporter::numberToString(int n) {
|
||||||
|
std::stringstream str;
|
||||||
|
str << n;
|
||||||
|
return str.str();
|
||||||
|
}
|
||||||
|
|
||||||
MwIniImporter::multistrmap MwIniImporter::loadIniFile(std::string filename) {
|
MwIniImporter::multistrmap MwIniImporter::loadIniFile(std::string filename) {
|
||||||
std::cout << "load ini file: " << filename << std::endl;
|
std::cout << "load ini file: " << filename << std::endl;
|
||||||
|
|
||||||
|
@ -130,7 +137,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
|
||||||
multistrmap::iterator it = ini.begin();
|
multistrmap::iterator it = ini.begin();
|
||||||
for(int i=0; it != ini.end(); i++) {
|
for(int i=0; it != ini.end(); i++) {
|
||||||
gameFile = baseGameFile;
|
gameFile = baseGameFile;
|
||||||
gameFile.append(1,i+'0');
|
gameFile.append(this->numberToString(i));
|
||||||
|
|
||||||
it = ini.find(gameFile);
|
it = ini.find(gameFile);
|
||||||
if(it == ini.end()) {
|
if(it == ini.end()) {
|
||||||
|
@ -152,24 +159,19 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
|
||||||
gameFile = "";
|
gameFile = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!esmFiles.empty()) {
|
multistrmap::iterator it;
|
||||||
multistrmap::iterator it;
|
cfg.erase("master");
|
||||||
cfg.erase("master");
|
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) );
|
||||||
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++) {
|
||||||
for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) {
|
cfg["master"].push_back(*it);
|
||||||
cfg["master"].push_back(*it);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!espFiles.empty()) {
|
cfg.erase("plugin");
|
||||||
multistrmap::iterator it;
|
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) );
|
||||||
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);
|
||||||
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:
|
private:
|
||||||
bool specialMerge(std::string cfgKey, std::string iniKey, multistrmap &cfg, multistrmap &ini);
|
bool specialMerge(std::string cfgKey, std::string iniKey, multistrmap &cfg, multistrmap &ini);
|
||||||
|
std::string numberToString(int n);
|
||||||
bool mVerbose;
|
bool mVerbose;
|
||||||
strmap mMergeMap;
|
strmap mMergeMap;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue