mirror of https://github.com/OpenMW/openmw.git
Merge branch 'settings_default' into 'master'
Avoid using Settings::Manager::mDefaultSettings directly in the engine (#6876) See merge request OpenMW/openmw!29597344-support-launching-the-example-suite
commit
ebf6f50523
@ -1,12 +1,24 @@
|
||||
#include "values.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Settings
|
||||
{
|
||||
Values* Values::sValues = nullptr;
|
||||
|
||||
void Values::init()
|
||||
void Values::initDefaults()
|
||||
{
|
||||
if (Values::sValues != nullptr)
|
||||
throw std::logic_error("Default settings already initialized");
|
||||
static Values values;
|
||||
Values::sValues = &values;
|
||||
}
|
||||
|
||||
void Values::init()
|
||||
{
|
||||
if (Values::sValues == nullptr)
|
||||
throw std::logic_error("Default settings are not initialized");
|
||||
static Values values(std::move(*Values::sValues));
|
||||
Values::sValues = &values;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue