mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 03:26:39 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			661 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 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;
 | 
						|
    }
 | 
						|
}
 |