2
0
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:
2015-12-03 17:43:29 -08:00
parent ee40f5217f
commit e458d97a2a
2 changed files with 16 additions and 0 deletions

View File

@@ -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();