diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index e19e099580..af281f4462 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -980,6 +981,24 @@ namespace MWWorld return TypedDynamicStore::search(ESM::RefId::stringRefId(id)); } + void Store::setUp() + { + auto addSetting = [&](const std::string& key, ESM::Variant value) { + ESM::GameSetting setting; + setting.blank(); + setting.mId = ESM::RefId::stringRefId(key); + setting.mValue = std::move(value); + mStatic.emplace(setting.mId, std::move(setting)); + }; + for (auto& [key, value] : Fallback::Map::getIntFallbackMap()) + addSetting(key, ESM::Variant(value)); + for (auto& [key, value] : Fallback::Map::getFloatFallbackMap()) + addSetting(key, ESM::Variant(value)); + for (auto& [key, value] : Fallback::Map::getNonNumericFallbackMap()) + addSetting(key, ESM::Variant(value)); + TypedDynamicStore::setUp(); + } + // Magic effect //========================================================================= Store::Store() {} diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index b6e9044184..2e73007113 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -292,6 +292,8 @@ namespace MWWorld const ESM::GameSetting* find(const std::string_view id) const; const ESM::GameSetting* search(const std::string_view id) const; + + void setUp() override; }; template <> diff --git a/components/fallback/fallback.hpp b/components/fallback/fallback.hpp index 3b0bbb6067..05654d8b9b 100644 --- a/components/fallback/fallback.hpp +++ b/components/fallback/fallback.hpp @@ -19,6 +19,13 @@ namespace Fallback public: static void init(const std::map& fallback); + static const std::map>& getIntFallbackMap() { return mIntFallbackMap; } + static const std::map>& getFloatFallbackMap() { return mFloatFallbackMap; } + static const std::map>& getNonNumericFallbackMap() + { + return mNonNumericFallbackMap; + } + static std::string_view getString(std::string_view fall); static float getFloat(std::string_view fall); static int getInt(std::string_view fall);