From e8d4669a8e23bac652c847b0f4d51f42944d0387 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Mon, 15 Apr 2024 02:03:16 -0300 Subject: [PATCH] custom SettingValue needs a ctor, add it to the example --- mods/settings.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/settings.md b/mods/settings.md index e012116..6d8d471 100644 --- a/mods/settings.md +++ b/mods/settings.md @@ -128,6 +128,12 @@ class MySettingValue : public SettingValue { // you are free to do whatever! public: + // Make sure to have a public constructor! + // Typically you always have these first two args, + // since Mod::addCustomSetting expects them. + MySettingValue(std::string const& key, std::string const& mod, T someValue) + : SettingValue(key, mod), m_someMember(someValue) {} + bool load(matjson::Value const& json) override { // load the value of the setting from json, // returning true if loading was succesful