From 2a9b12bb3fb844f30aba7d9fada0170e3b86c1c9 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 11 Jul 2016 14:15:35 +0100 Subject: [PATCH] Fix an issue preventing compilation, revealing another that doesn't make much sense. --- apps/openmw/main.cpp | 4 ++-- components/fallback/validate.hpp | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index cd45ddcf5..9be1e8a7f 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -145,7 +145,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat "\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n" "\n\twin1252 - Western European (Latin) alphabet, used by default") - ("fallback", bpo::value()->default_value(FallbackMap(), "") + ("fallback", bpo::value()->default_value(EscapeFallbackMap(), "") ->multitoken()->composing(), "fallback values") ("no-grab", "Don't grab mouse cursor") @@ -248,7 +248,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat // other settings engine.setSoundUsage(!variables["no-sound"].as()); - engine.setFallbackValues(variables["fallback"].as().mMap); + engine.setFallbackValues(variables["fallback"].as().toFallbackMap().mMap); engine.setActivationDistanceOverride (variables["activate-dist"].as()); engine.enableFontExport(variables["export-fonts"].as()); diff --git a/components/fallback/validate.hpp b/components/fallback/validate.hpp index 531711544..c41ff6b96 100644 --- a/components/fallback/validate.hpp +++ b/components/fallback/validate.hpp @@ -13,9 +13,22 @@ namespace Fallback { struct FallbackMap { - std::map mMap; + std::map mMap; }; + struct EscapeFallbackMap : FallbackMap + { + std::map mMap; + + FallbackMap toFallbackMap() const + { + FallbackMap temp = FallbackMap(); + for (std::map::const_iterator it = mMap.begin(); it != mMap.end(); ++it) + temp.mMap[it->first.toStdString()] = it->second.toStdString(); + return temp; + } + }; + void validate(boost::any &v, std::vector const &tokens, FallbackMap*, int) { if(v.empty())