Minor fixes

This commit is contained in:
Phillip Stephens 2019-09-29 08:17:01 -07:00
parent 7fd54effc9
commit 6b56f2e6a4
4 changed files with 5 additions and 4 deletions

View File

@ -124,8 +124,6 @@ public:
bool isColor() const; bool isColor() const;
bool wasDeserialized() const; bool wasDeserialized() const;
bool hasDefaultValue() const; bool hasDefaultValue() const;
void clearModified();
void setModified();
EType type() const { return m_type; } EType type() const { return m_type; }
EFlags flags() const { return (m_unlocked ? m_oldFlags : m_flags); } EFlags flags() const { return (m_unlocked ? m_oldFlags : m_flags); }
@ -153,6 +151,8 @@ public:
private: private:
CVar(std::string_view name, std::string_view help, EType type) : m_help(help), m_type(type) { m_name = name; } CVar(std::string_view name, std::string_view help, EType type) : m_help(help), m_type(type) { m_name = name; }
void dispatch(); void dispatch();
void clearModified();
void setModified();
std::string m_help; std::string m_help;
EType m_type; EType m_type;
std::string m_defaultValue; std::string m_defaultValue;

View File

@ -415,6 +415,7 @@ bool CVar::fromLiteralToType(std::string_view val) {
if (!safeToModify(m_type) || !isValidInput(val)) if (!safeToModify(m_type) || !isValidInput(val))
return false; return false;
m_value = val; m_value = val;
setModified();
return true; return true;
} }

View File

@ -331,6 +331,8 @@ void CVarManager::proc() {
for (const auto& [name, cvar] : m_cvars) { for (const auto& [name, cvar] : m_cvars) {
if (cvar->isModified() && !cvar->modificationRequiresRestart()) { if (cvar->isModified() && !cvar->modificationRequiresRestart()) {
cvar->dispatch(); cvar->dispatch();
// Clear the modified flag now that we've informed everyone we've changed
cvar->clearModified();
} }
} }
} }

View File

@ -175,12 +175,10 @@ void Console::init(boo::IWindow* window) {
void Console::proc() { void Console::proc() {
if (m_conHeight->isModified()) { if (m_conHeight->isModified()) {
m_cachedConHeight = m_conHeight->toReal(); m_cachedConHeight = m_conHeight->toReal();
m_conHeight->clearModified();
} }
if (m_conSpeed->isModified()) { if (m_conSpeed->isModified()) {
m_cachedConSpeed = m_conSpeed->toReal(); m_cachedConSpeed = m_conSpeed->toReal();
m_conSpeed->clearModified();
} }
if (m_state == State::Opened) { if (m_state == State::Opened) {