Skip to content

Commit

Permalink
custom SettingValue needs a ctor, add it to the example
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool authored Apr 15, 2024
1 parent bce6d27 commit e8d4669
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mods/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e8d4669

Please sign in to comment.