Codechange: use initializer_lists for the settings tables
Not using vectors as those require copying from the initializer list and that makes unique_ptrs to the actual SettingDesc objects later impossible.
This commit is contained in:
@@ -12,13 +12,12 @@ static bool UpdateIntervalRoadVeh(int32 p1);
|
||||
static bool UpdateIntervalShips(int32 p1);
|
||||
static bool UpdateIntervalAircraft(int32 p1);
|
||||
|
||||
static const SettingDesc _company_settings[] = {
|
||||
static const SettingTable _company_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_END = SDT_END()
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
@@ -136,8 +135,3 @@ str = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
||||
proc = UpdateIntervalAircraft
|
||||
|
||||
[SDT_END]
|
||||
|
||||
|
||||
};
|
||||
|
@@ -5,13 +5,12 @@
|
||||
;
|
||||
|
||||
[pre-amble]
|
||||
static const SettingDesc _currency_settings[] = {
|
||||
static const SettingTable _currency_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_VAR = SDT_VAR ($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_SSTR = SDT_SSTR($base, $var, $type, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_END = SDT_END()
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
@@ -67,6 +66,3 @@ base = CurrencySpec
|
||||
var = suffix
|
||||
type = SLE_STRQ
|
||||
def = "" credits""
|
||||
|
||||
[SDT_END]
|
||||
|
||||
|
@@ -23,7 +23,7 @@ static const char *_osk_activation = "disabled|double|single|immediately";
|
||||
static const char *_settings_profiles = "easy|medium|hard";
|
||||
static const char *_news_display = "off|summarized|full";
|
||||
|
||||
static const SettingDesc _gameopt_settings[] = {
|
||||
static const SettingTable _gameopt_settings{
|
||||
/* In version 4 a new difficulty setting has been added to the difficulty settings,
|
||||
* town attitude towards demolishing. Needs special handling because some dimwit thought
|
||||
* it funny to have the GameDifficulty struct be an array while it is a struct of
|
||||
@@ -43,7 +43,6 @@ SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $guiflags, $def, $ma
|
||||
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_OMANY = SDT_OMANY($base, $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $load, $cat, $extra, $startup),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_END = SDT_END()
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -186,6 +185,3 @@ def = 1
|
||||
max = 1
|
||||
full = _roadsides
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_END]
|
||||
|
||||
|
@@ -16,7 +16,7 @@ extern bool _allow_hidpi_window;
|
||||
#define WITHOUT_COCOA
|
||||
#endif
|
||||
|
||||
static const SettingDesc _misc_settings[] = {
|
||||
static const SettingTable _misc_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
@@ -26,7 +26,6 @@ SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def,
|
||||
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDTG_END = SDTG_END()
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -353,6 +352,3 @@ ifdef = WITH_COCOA
|
||||
name = ""allow_hidpi""
|
||||
var = _allow_hidpi_window
|
||||
def = true
|
||||
|
||||
[SDTG_END]
|
||||
|
||||
|
@@ -83,8 +83,6 @@ static size_t ConvertLandscape(const char *value);
|
||||
#define SDTG_NULL(length, from, to)\
|
||||
{{"", nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLEG_NULL(length, from, to)}
|
||||
|
||||
#define SDTG_END() {{nullptr, nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLEG_END()}
|
||||
|
||||
/* Macros for various objects to go in the configuration file.
|
||||
* This section is for structures where their various members are saved */
|
||||
#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, strhelp, strval, proc, load, from, to, cat, extra, startup)\
|
||||
@@ -127,5 +125,3 @@ static size_t ConvertLandscape(const char *value);
|
||||
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
|
||||
SDTG_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, 0, max, 0, full, str, strhelp, strval, proc, from, to, cat, extra, startup)
|
||||
|
||||
#define SDT_END() {{nullptr, nullptr, SDT_NUMX, SGF_NONE, 0, 0, 0, nullptr, STR_NULL, STR_NULL, STR_NULL, nullptr, nullptr, SC_NONE, false}, SLE_END()}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ static bool UpdateClientConfigValues(int32 p1);
|
||||
* assigns its own value. If the setting was company-based, that would mean that
|
||||
* vehicles could decide on different moments that they are heading back to a
|
||||
* service depot, causing desyncs on a massive scale. */
|
||||
const SettingDesc _settings[] = {
|
||||
const SettingTable _settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
@@ -76,7 +76,6 @@ SDT_OMANY = SDT_OMANY($base, $var, $type, $flags, $guiflags, $def,
|
||||
SDT_SSTR = SDT_SSTR($base, $var, $type, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_NULL = SDT_NULL($length, $from, $to),
|
||||
SDT_END = SDT_END()
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -4112,6 +4111,3 @@ str = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU
|
||||
strhelp = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_COMMAND
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_END]
|
||||
|
||||
|
@@ -9,14 +9,13 @@
|
||||
#if defined(_WIN32) && !defined(DEDICATED)
|
||||
extern bool _window_maximize;
|
||||
|
||||
static const SettingDesc _win32_settings[] = {
|
||||
static const SettingTable _win32_settings{
|
||||
[post-amble]
|
||||
};
|
||||
#endif /* _WIN32 */
|
||||
[templates]
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDTG_END = SDTG_END()
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -42,6 +41,3 @@ name = ""window_maximize""
|
||||
var = _window_maximize
|
||||
def = false
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDTG_END]
|
||||
|
||||
|
@@ -6,13 +6,12 @@
|
||||
|
||||
[pre-amble]
|
||||
|
||||
static const SettingDesc _window_settings[] = {
|
||||
static const SettingTable _window_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
|
||||
SDT_END = SDT_END()
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
@@ -52,7 +51,3 @@ type = SLE_INT16
|
||||
def = 0
|
||||
min = 0
|
||||
max = 32000
|
||||
|
||||
[SDT_END]
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user