summaryrefslogtreecommitdiff
path: root/src/settings_internal.h
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-23 10:47:12 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-27 18:49:43 +0200
commit91b3d697c506473deb47d70a31de5d5a7a063483 (patch)
tree064dd35554ce5675fae2d4493c1322a7a70dff8c /src/settings_internal.h
parentcf6b91f30f2e923b0084255e4082605803d2fd32 (diff)
downloadopenttd-91b3d697c506473deb47d70a31de5d5a7a063483.tar.xz
Codechange: make SettingDesc an instance in the setting table to allow for sub classes
Diffstat (limited to 'src/settings_internal.h')
-rw-r--r--src/settings_internal.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/settings_internal.h b/src/settings_internal.h
index fca85de0c..4aebe6b79 100644
--- a/src/settings_internal.h
+++ b/src/settings_internal.h
@@ -82,7 +82,7 @@ typedef bool OnChange(int32 var); ///< callback prototype on data modi
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
/** Properties of config file settings. */
-struct SettingDescBase {
+struct SettingDesc {
const char *name; ///< name of the setting. Used in configuration file and for console
const void *def; ///< default value given when none is present
SettingDescType cmd; ///< various flags for the variable
@@ -98,16 +98,13 @@ struct SettingDescBase {
OnConvert *proc_cnvt; ///< callback procedure when loading value mechanism fails
SettingCategory cat; ///< assigned categories of the setting
bool startup; ///< setting has to be loaded directly at startup?
-};
-
-struct SettingDesc : SettingDescBase {
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
bool IsEditable(bool do_command = false) const;
SettingType GetType() const;
};
-typedef std::initializer_list<const SettingDesc> SettingTable;
+typedef std::initializer_list<std::unique_ptr<const SettingDesc>> SettingTable;
const SettingDesc *GetSettingFromName(const char *name);
bool SetSettingValue(const SettingDesc *sd, int32 value, bool force_newgame = false);