diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/settings.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 2879237cc..4ca8299b3 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -200,6 +200,8 @@ public: virtual bool RuntimeModfiable() const = 0; virtual void SetGlobal(bool global) {} virtual constexpr u32 Id() const = 0; + virtual std::string MinVal() const = 0; + virtual std::string MaxVal() const = 0; virtual bool UsingGlobal() const { return false; } @@ -336,7 +338,7 @@ protected: if constexpr (std::is_same<Type, std::string>()) { return value_; } else if constexpr (std::is_same<Type, std::optional<u32>>()) { - return value_.has_value() ? std::to_string(*value_) : "0"; + return value_.has_value() ? std::to_string(*value_) : "none"; } else if constexpr (std::is_same<Type, bool>()) { return value_ ? "true" : "false"; } else { @@ -401,7 +403,7 @@ public: if constexpr (std::is_same<Type, std::string>()) { this->SetValue(input); } else if constexpr (std::is_same<Type, std::optional<u32>>()) { - this->SetValue(static_cast<u32>(std::stoll(input))); + this->SetValue(static_cast<u32>(std::stoul(input))); } else if constexpr (std::is_same<Type, bool>()) { this->SetValue(input == "true"); } else { @@ -435,6 +437,13 @@ public: return id; } + virtual std::string MinVal() const override { + return this->ToString(minimum); + } + virtual std::string MaxVal() const override { + return this->ToString(maximum); + } + protected: Type value{}; ///< The setting const Type default_value{}; ///< The default value |