mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
allways merge fallback; better syntax
This commit is contained in:
parent
ab9c430632
commit
2d23d79fd5
3 changed files with 12 additions and 16 deletions
|
@ -14,18 +14,16 @@ MwIniImporter::MwIniImporter() {
|
|||
{ "fps", "General:Show FPS" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
const char *fallback[][2] = {
|
||||
{ "Weather_Sunrise_Time", "Weather:Sunrise Time" },
|
||||
{ "Weather_Sunset_Time", "Weather:Sunset Time" },
|
||||
{ 0, 0 }
|
||||
const char *fallback[] = {
|
||||
"Weather:Sunrise Time", "Weather_Sunset_Time", 0
|
||||
};
|
||||
|
||||
for(int i=0; map[i][0]; i++) {
|
||||
mMergeMap.insert(std::make_pair<std::string, std::string>(map[i][0], map[i][1]));
|
||||
}
|
||||
|
||||
for(int i=0; fallback[i][0]; i++) {
|
||||
mMergeFallback.insert(std::make_pair<std::string, std::string>(fallback[i][0], fallback[i][1]));
|
||||
for(int i=0; fallback[i]; i++) {
|
||||
mMergeFallback.push_back(fallback[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,11 +136,13 @@ void MwIniImporter::mergeFallback(multistrmap &cfg, multistrmap &ini) {
|
|||
|
||||
multistrmap::iterator cfgIt;
|
||||
multistrmap::iterator iniIt;
|
||||
for(strmap::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); it++) {
|
||||
if((iniIt = ini.find(it->second)) != ini.end()) {
|
||||
for(std::vector<std::string>::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); it++) {
|
||||
if((iniIt = ini.find(*it)) != ini.end()) {
|
||||
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) {
|
||||
std::string value(it->first);
|
||||
value.append("=").append(vc->substr(0,vc->length()-1));
|
||||
std::string value(*it);
|
||||
std::replace( value.begin(), value.end(), ' ', '_' );
|
||||
std::replace( value.begin(), value.end(), ':', '_' );
|
||||
value.append(",").append(vc->substr(0,vc->length()-1));
|
||||
insertMultistrmap(cfg, "fallback", value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class MwIniImporter {
|
|||
std::string numberToString(int n);
|
||||
bool mVerbose;
|
||||
strmap mMergeMap;
|
||||
strmap mMergeFallback;
|
||||
std::vector<std::string> mMergeFallback;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ int main(int argc, char *argv[]) {
|
|||
("ini,i", bpo::value<std::string>(), "morrowind.ini file")
|
||||
("cfg,c", bpo::value<std::string>(), "openmw.cfg file")
|
||||
("output,o", bpo::value<std::string>()->default_value(""), "openmw.cfg file")
|
||||
("fallback,f", "import fallback settings")
|
||||
("game-files,g", "import esm and esp files")
|
||||
;
|
||||
|
||||
|
@ -55,10 +54,7 @@ int main(int argc, char *argv[]) {
|
|||
MwIniImporter::multistrmap cfg = importer.loadCfgFile(cfgFile);
|
||||
|
||||
importer.merge(cfg, ini);
|
||||
|
||||
if(vm.count("fallback")) {
|
||||
importer.mergeFallback(cfg, ini);
|
||||
}
|
||||
importer.mergeFallback(cfg, ini);
|
||||
|
||||
if(vm.count("game-files")) {
|
||||
importer.importGameFiles(cfg, ini);
|
||||
|
|
Loading…
Reference in a new issue