diff options
author | rubidium42 <rubidium@openttd.org> | 2021-06-21 18:41:30 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-26 20:28:34 +0200 |
commit | f35e6c1c7fdaefc9153a54c089dbaa6e2549e6b1 (patch) | |
tree | 739a08e82139c07d785fd2cdc4a339ae50ce7859 /src/settings_internal.h | |
parent | c93fcbcb286222f366c2e182a337c52c50fe36d5 (diff) | |
download | openttd-f35e6c1c7fdaefc9153a54c089dbaa6e2549e6b1.tar.xz |
Codechange: use C-style strings instread of std::string in the SettingDesc constructor
This as using std::string causes much more variables to be tracked, potentially causing problemes for certain compilers in certain situations
Diffstat (limited to 'src/settings_internal.h')
-rw-r--r-- | src/settings_internal.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/settings_internal.h b/src/settings_internal.h index 5ba7ca454..5b35d328a 100644 --- a/src/settings_internal.h +++ b/src/settings_internal.h @@ -69,7 +69,7 @@ struct IniItem; /** Properties of config file settings. */ struct SettingDesc { - SettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup) : + SettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup) : name(name), flags(flags), startup(startup), save(save) {} virtual ~SettingDesc() {} @@ -140,7 +140,7 @@ struct IntSettingDesc : SettingDesc { */ typedef void PostChangeCallback(int32 value); - IntSettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, int32 def, + IntSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, int32 def, int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) : SettingDesc(save, name, flags, startup), def(def), min(min), max(max), interval(interval), @@ -182,7 +182,7 @@ private: /** Boolean setting. */ struct BoolSettingDesc : IntSettingDesc { - BoolSettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, bool def, + BoolSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, bool def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) : IntSettingDesc(save, name, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat, @@ -198,7 +198,7 @@ struct BoolSettingDesc : IntSettingDesc { struct OneOfManySettingDesc : IntSettingDesc { typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error - OneOfManySettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, int32 def, + OneOfManySettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, std::initializer_list<const char *> many, OnConvert *many_cnvt) : @@ -222,7 +222,7 @@ struct OneOfManySettingDesc : IntSettingDesc { /** Many of many setting. */ struct ManyOfManySettingDesc : OneOfManySettingDesc { - ManyOfManySettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, + ManyOfManySettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, std::initializer_list<const char *> many, OnConvert *many_cnvt) : @@ -251,7 +251,7 @@ struct StringSettingDesc : SettingDesc { */ typedef void PostChangeCallback(const std::string &value); - StringSettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, const char *def, + StringSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, const char *def, uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) : SettingDesc(save, name, flags, startup), def(def == nullptr ? "" : def), max_length(max_length), pre_check(pre_check), post_callback(post_callback) {} @@ -277,7 +277,7 @@ private: /** List/array settings. */ struct ListSettingDesc : SettingDesc { - ListSettingDesc(SaveLoad save, const std::string &name, SettingFlag flags, bool startup, const char *def) : + ListSettingDesc(SaveLoad save, const char *name, SettingFlag flags, bool startup, const char *def) : SettingDesc(save, name, flags, startup), def(def) {} virtual ~ListSettingDesc() {} @@ -291,7 +291,7 @@ struct ListSettingDesc : SettingDesc { /** Placeholder for settings that have been removed, but might still linger in the savegame. */ struct NullSettingDesc : SettingDesc { NullSettingDesc(SaveLoad save) : - SettingDesc(save, {}, SF_NOT_IN_CONFIG, false) {} + SettingDesc(save, "", SF_NOT_IN_CONFIG, false) {} virtual ~NullSettingDesc() {} void FormatValue(char *buf, const char *last, const void *object) const override { NOT_REACHED(); } |