mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 00:27:42 +00:00
Make CVarManager a singleton
This commit is contained in:
@@ -12,11 +12,14 @@ CVar* com_developer = nullptr;
|
||||
CVar* com_configfile = nullptr;
|
||||
CVar* com_enableCheats = nullptr;
|
||||
|
||||
CVarManager* CVarManager::m_instance = nullptr;
|
||||
|
||||
LogVisor::LogModule CVarLog("CVarManager");
|
||||
CVarManager::CVarManager(HECL::Runtime::FileStoreManager& store, bool useBinary)
|
||||
: m_store(store),
|
||||
m_useBinary(useBinary)
|
||||
{
|
||||
m_instance = this;
|
||||
com_configfile = newCVar("config", "File to store configuration", std::string("config"), CVar::EFlags::System);
|
||||
com_developer = newCVar("developer", "Enables developer mode", false, (CVar::EFlags::System | CVar::EFlags::Cheat | CVar::EFlags::ReadOnly));
|
||||
com_enableCheats = newCVar("iamaweiner", "Enable cheats", false, (CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::Hidden));
|
||||
@@ -167,6 +170,11 @@ void CVarManager::serialize()
|
||||
}
|
||||
}
|
||||
|
||||
CVarManager* CVarManager::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
bool CVarManager::suppressDeveloper()
|
||||
{
|
||||
bool oldDeveloper = com_developer->toBoolean();
|
||||
|
||||
Reference in New Issue
Block a user