diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index f7ddb2bf0..a82240a8a 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -6,6 +6,7 @@ #include #include #include +#include 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 > ("master", std::vector() ) ); - - for(std::vector::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) { - cfg["master"].push_back(*it); - } + multistrmap::iterator it; + cfg.erase("master"); + cfg.insert( std::make_pair > ("master", std::vector() ) ); + + for(std::vector::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 > ("plugin", std::vector() ) ); - - for(std::vector::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { - cfg["plugin"].push_back(*it); - } + cfg.erase("plugin"); + cfg.insert( std::make_pair > ("plugin", std::vector() ) ); + + for(std::vector::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { + cfg["plugin"].push_back(*it); } } diff --git a/apps/mwiniimporter/importer.hpp b/apps/mwiniimporter/importer.hpp index 454dc209a..988f10255 100644 --- a/apps/mwiniimporter/importer.hpp +++ b/apps/mwiniimporter/importer.hpp @@ -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; };