1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/components/settings/values.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
661 B
C++
Raw Normal View History

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