summaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-23 19:16:56 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-27 18:49:43 +0200
commite666a962b1f0f8eeb3bab2232ce77556ddab974a (patch)
treeb7802361743f548da4d6e12c3380a5395cca45f3 /src/table
parent860003458fc17f02e44b50f98ef570aff824142a (diff)
downloadopenttd-e666a962b1f0f8eeb3bab2232ce77556ddab974a.tar.xz
Codechange: let OneOfMany and ManyOfMany be their own classes as well
Diffstat (limited to 'src/table')
-rw-r--r--src/table/gameopt_settings.ini20
-rw-r--r--src/table/misc_settings.ini5
-rw-r--r--src/table/settings.h.preamble8
3 files changed, 17 insertions, 16 deletions
diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini
index 1e60770f2..56ac7d781 100644
--- a/src/table/gameopt_settings.ini
+++ b/src/table/gameopt_settings.ini
@@ -12,16 +12,16 @@ uint8 _old_units; ///< Old units from old s
/* Most of these strings are used both for gameopt-backward compatibility
* and the settings tables. The rest is here for consistency. */
-static const char *_locale_currencies = "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|RON|RUR|SIT|SEK|YTL|SKK|BRL|EEK|custom";
-static const char *_locale_units = "imperial|metric|si|gameunits";
-static const char *_town_names = "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovak|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan";
-static const char *_climates = "temperate|arctic|tropic|toyland";
-static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly";
-static const char *_roadsides = "left|right";
-static const char *_savegame_date = "long|short|iso";
-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 std::initializer_list<const char*> _locale_currencies{"GBP", "USD", "EUR", "YEN", "ATS", "BEF", "CHF", "CZK", "DEM", "DKK", "ESP", "FIM", "FRF", "GRD", "HUF", "ISK", "ITL", "NLG", "NOK", "PLN", "RON", "RUR", "SIT", "SEK", "YTL", "SKK", "BRL", "EEK", "custom"};
+static std::initializer_list<const char*> _locale_units{"imperial", "metric", "si", "gameunits"};
+static std::initializer_list<const char*> _town_names{"english", "french", "german", "american", "latin", "silly", "swedish", "dutch", "finnish", "polish", "slovak", "norwegian", "hungarian", "austrian", "romanian", "czech", "swiss", "danish", "turkish", "italian", "catalan"};
+static std::initializer_list<const char*> _climates{"temperate", "arctic", "tropic", "toyland"};
+static std::initializer_list<const char*> _autosave_interval{"off", "monthly", "quarterly", "half year", "yearly"};
+static std::initializer_list<const char*> _roadsides{"left", "right"};
+static std::initializer_list<const char*> _savegame_date{"long", "short", "iso"};
+static std::initializer_list<const char*> _osk_activation{"disabled", "double", "single", "immediately"};
+static std::initializer_list<const char*> _settings_profiles{"easy", "medium", "hard"};
+static std::initializer_list<const char*> _news_display{ "off", "summarized", "full"};
static const SettingTable _gameopt_settings{
/* In version 4 a new difficulty setting has been added to the difficulty settings,
diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini
index a3efbc65e..017320c86 100644
--- a/src/table/misc_settings.ini
+++ b/src/table/misc_settings.ini
@@ -7,7 +7,8 @@
[pre-amble]
extern std::string _config_language_file;
-static const char *_support8bppmodes = "no|system|hardware";
+static std::initializer_list<const char*> _support8bppmodes{"no", "system" , "hardware"};
+static std::initializer_list<const char*> _display_opt_modes{"SHOW_TOWN_NAMES", "SHOW_STATION_NAMES", "SHOW_SIGNS", "FULL_ANIMATION", "", "FULL_DETAIL", "WAYPOINTS", "SHOW_COMPETITOR_SIGNS"};
#ifdef WITH_COCOA
extern bool _allow_hidpi_window;
@@ -53,7 +54,7 @@ name = ""display_opt""
type = SLE_UINT8
var = _display_opt
def = (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_SHOW_WAYPOINT_NAMES | 1 << DO_SHOW_COMPETITOR_SIGNS)
-full = ""SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS|SHOW_COMPETITOR_SIGNS""
+full = _display_opt_modes
[SDTG_BOOL]
name = ""fullscreen""
diff --git a/src/table/settings.h.preamble b/src/table/settings.h.preamble
index c6788f707..df10b6deb 100644
--- a/src/table/settings.h.preamble
+++ b/src/table/settings.h.preamble
@@ -71,10 +71,10 @@ static size_t ConvertLandscape(const char *value);
NSD(String, SLEG_GENERAL(SL_STDSTR, var, type | flags, sizeof(var), from, to, extra), name, guiflags, SDT_STDSTRING, startup, def, max_length, proc)
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
- NSD(Int, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_ONEOFMANY, startup, def, 0, max, 0, str, strhelp, strval, cat, proc, full)
+ NSD(OneOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_ONEOFMANY, startup, def, max, str, strhelp, strval, cat, proc, full, nullptr)
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, proc, from, to, cat, extra, startup)\
- NSD(Int, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_MANYOFMANY, startup, def, 0, 0, 0, str, strhelp, strval, cat, proc, full)
+ NSD(ManyOfMany, SLEG_GENERAL(SL_VAR, var, type | flags, 1, from, to, extra), name, guiflags, SDT_MANYOFMANY, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
#define SDTG_NULL(length, from, to)\
NSD(Null, SLEG_NULL(length, from, to))
@@ -94,10 +94,10 @@ static size_t ConvertLandscape(const char *value);
NSD(String, SLE_GENERAL(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extra), #var, guiflags, SDT_STDSTRING, startup, def, 0, proc)
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, load, cat, extra, startup)\
- NSD(Int, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_ONEOFMANY, startup, def, 0, max, 0, str, strhelp, strval, cat, proc, full, load)
+ NSD(OneOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_ONEOFMANY, startup, def, max, str, strhelp, strval, cat, proc, full, load)
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc, strhelp, strval, from, to, cat, extra, startup)\
- NSD(Int, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_MANYOFMANY, startup, def, 0, 0, 0, str, strhelp, strval, cat, proc, full, nullptr)
+ NSD(ManyOfMany, SLE_GENERAL(SL_VAR, base, var, type | flags, 1, from, to, extra), #var, guiflags, SDT_MANYOFMANY, startup, def, str, strhelp, strval, cat, proc, full, nullptr)
#define SDT_NULL(length, from, to)\
NSD(Null, SLE_CONDNULL(length, from, to))