summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-06-21 18:41:30 +0200
committerPatric Stout <github@truebrain.nl>2021-06-26 20:28:34 +0200
commitf35e6c1c7fdaefc9153a54c089dbaa6e2549e6b1 (patch)
tree739a08e82139c07d785fd2cdc4a339ae50ce7859 /src
parentc93fcbcb286222f366c2e182a337c52c50fe36d5 (diff)
downloadopenttd-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')
-rw-r--r--src/settings_internal.h16
-rw-r--r--src/table/settings/settings.ini10
2 files changed, 13 insertions, 13 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(); }
diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini
index 7c5cac886..6fe4d9d51 100644
--- a/src/table/settings/settings.ini
+++ b/src/table/settings/settings.ini
@@ -1002,14 +1002,14 @@ post_cb = MaxVehiclesChanged
cat = SC_BASIC
[SDTG_BOOL]
-name = {}
+name = """"
flags = SF_NO_NETWORK
var = _old_vds.servint_ispercent
def = false
to = SLV_120
[SDTG_VAR]
-name = {}
+name = """"
type = SLE_UINT16
flags = SF_GUI_0_IS_SPECIAL
var = _old_vds.servint_trains
@@ -1019,7 +1019,7 @@ max = 800
to = SLV_120
[SDTG_VAR]
-name = {}
+name = """"
type = SLE_UINT16
flags = SF_GUI_0_IS_SPECIAL
var = _old_vds.servint_roadveh
@@ -1029,7 +1029,7 @@ max = 800
to = SLV_120
[SDTG_VAR]
-name = {}
+name = """"
type = SLE_UINT16
flags = SF_GUI_0_IS_SPECIAL
var = _old_vds.servint_ships
@@ -1039,7 +1039,7 @@ max = 800
to = SLV_120
[SDTG_VAR]
-name = {}
+name = """"
type = SLE_UINT16
flags = SF_GUI_0_IS_SPECIAL
var = _old_vds.servint_aircraft