diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 0dc534377..e1ddb03e7 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -54,6 +54,35 @@ inline boost::filesystem::path lexical_cast mMap; + + static void + validate(boost::any &v, std::vector const &tokens) + { + if(v.empty()) + { + v = boost::any(FallbackMap()); + } + + FallbackMap *map = boost::any_cast(&v); + + std::map::iterator mapIt; + for(std::vector::const_iterator it=tokens.begin(); it != tokens.end(); it++) + { + int sep = it->find(","); + std::string key(it->substr(0,sep-1)); + std::string value(it->substr(sep)); + + if((mapIt = map->mMap.find(key)) == map->mMap.end()) + { + map->mMap.insert(std::make_pair(key,value)); + } + } + } +}; + + /** * \brief Parses application command line and calls \ref Cfg::ConfigurationManager * to parse configuration files. @@ -126,7 +155,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat ("report-focus", bpo::value()->implicit_value(true) ->default_value(false), "write name of focussed object to cout") - ("fallback", bpo::value()->default_value(StringsVector(), "") + ("fallback", bpo::value() ->multitoken()->composing(), "fallback values") ; @@ -236,7 +265,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat engine.setCompileAll(variables["script-all"].as()); engine.setReportFocus(variables["report-focus"].as()); engine.setAnimationVerbose(variables["anim-verbose"].as()); - engine.setFallbackValues(variables["fallback"].as >()); + //engine.setFallbackValues(variables["fallback"].as >()); return true; }