diff --git a/hecl/include/hecl/CVar.hpp b/hecl/include/hecl/CVar.hpp index d38b5496a..b5490865f 100644 --- a/hecl/include/hecl/CVar.hpp +++ b/hecl/include/hecl/CVar.hpp @@ -124,8 +124,6 @@ public: bool isColor() const; bool wasDeserialized() const; bool hasDefaultValue() const; - void clearModified(); - void setModified(); EType type() const { return m_type; } EFlags flags() const { return (m_unlocked ? m_oldFlags : m_flags); } @@ -153,6 +151,8 @@ public: private: CVar(std::string_view name, std::string_view help, EType type) : m_help(help), m_type(type) { m_name = name; } void dispatch(); + void clearModified(); + void setModified(); std::string m_help; EType m_type; std::string m_defaultValue; diff --git a/hecl/lib/CVar.cpp b/hecl/lib/CVar.cpp index 64cbbca87..37575eb6a 100644 --- a/hecl/lib/CVar.cpp +++ b/hecl/lib/CVar.cpp @@ -415,6 +415,7 @@ bool CVar::fromLiteralToType(std::string_view val) { if (!safeToModify(m_type) || !isValidInput(val)) return false; m_value = val; + setModified(); return true; } diff --git a/hecl/lib/CVarManager.cpp b/hecl/lib/CVarManager.cpp index 07647df67..00d38b0c0 100644 --- a/hecl/lib/CVarManager.cpp +++ b/hecl/lib/CVarManager.cpp @@ -331,6 +331,8 @@ void CVarManager::proc() { for (const auto& [name, cvar] : m_cvars) { if (cvar->isModified() && !cvar->modificationRequiresRestart()) { cvar->dispatch(); + // Clear the modified flag now that we've informed everyone we've changed + cvar->clearModified(); } } } diff --git a/hecl/lib/Console.cpp b/hecl/lib/Console.cpp index 3a8390e28..60f526cc6 100644 --- a/hecl/lib/Console.cpp +++ b/hecl/lib/Console.cpp @@ -175,12 +175,10 @@ void Console::init(boo::IWindow* window) { void Console::proc() { if (m_conHeight->isModified()) { m_cachedConHeight = m_conHeight->toReal(); - m_conHeight->clearModified(); } if (m_conSpeed->isModified()) { m_cachedConSpeed = m_conSpeed->toReal(); - m_conSpeed->clearModified(); } if (m_state == State::Opened) {