Minor fixes

This commit is contained in:
Phillip Stephens 2019-01-26 15:21:30 -08:00
parent 8cbb1e650f
commit 7542cb9650
3 changed files with 14 additions and 5 deletions

View File

@ -8,8 +8,7 @@
#include "hecl/Database.hpp"
namespace hecl::Database
{
namespace hecl::Database {
/* Centralized registry for DataSpec lookup */
std::vector<const struct DataSpecEntry*> DATA_SPEC_REGISTRY;
}
@ -17,7 +16,6 @@ std::vector<const struct DataSpecEntry*> DATA_SPEC_REGISTRY;
@HECL_DATASPEC_DECLS@
/* Please Call Me! */
void HECLRegisterDataSpecs()
{
void HECLRegisterDataSpecs() {
@HECL_DATASPEC_PUSHES@
}

View File

@ -74,6 +74,7 @@ public:
void getCVar(class Console* con, const std::vector<std::string>& args);
void setDeveloperMode(bool v, bool setDeserialized = false);
void setCheatsEnabled(bool v, bool setDeserialized = false);
bool restartRequired() const;
void parseCommandLine(const std::vector<SystemString>& args);

View File

@ -24,7 +24,8 @@ CVarManager::CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary)
com_developer = newCVar("developer", "Enables developer mode", false,
(CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::InternalArchivable));
com_enableCheats =
newCVar("cheats", "Enable cheats", false, (CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::Hidden));
newCVar("cheats", "Enable cheats", false,
(CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::Hidden | CVar::EFlags::InternalArchivable));
}
CVarManager::~CVarManager() {}
@ -251,6 +252,15 @@ void CVarManager::setDeveloperMode(bool v, bool setDeserialized) {
com_developer->setModified();
}
void CVarManager::setCheatsEnabled(bool v, bool setDeserialized) {
com_enableCheats->unlock();
com_enableCheats->fromBoolean(v);
if (setDeserialized)
com_enableCheats->m_wasDeserialized = true;
com_enableCheats->lock();
com_enableCheats->setModified();
}
bool CVarManager::restartRequired() const {
for (const auto& cv : m_cvars) {
if (cv.second->isModified() && cv.second->modificationRequiresRestart())