1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/components/settings/values.cpp

28 lines
661 B
C++

#include "values.hpp"
#include <stdexcept>
namespace Settings
{
Index* StaticValues::sIndex = nullptr;
Values* StaticValues::sValues = nullptr;
void StaticValues::initDefaults()
{
if (sValues != nullptr)
throw std::logic_error("Default settings already initialized");
static Index index;
static Values values(index);
sIndex = &index;
sValues = &values;
}
void StaticValues::init()
{
if (sValues == nullptr)
throw std::logic_error("Default settings are not initialized");
static Values values(std::move(*sValues));
sValues = &values;
}
}