Codechange: split off the settings table and all the callbacks from the main settings handling logic

This commit is contained in:
rubidium42
2021-07-05 17:46:38 +02:00
committed by rubidium42
parent b4aedc8bee
commit 25ca6a75bc
14 changed files with 529 additions and 458 deletions

View File

@@ -12,7 +12,7 @@ static void UpdateAllServiceInterval(int32 new_value);
static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);
static void UpdateServiceInterval(VehicleType type, int32 new_value);
static const SettingVariant _company_settings[] = {
static const SettingVariant _company_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -7,7 +7,7 @@
; Settings for the in-game custom currency.
[pre-amble]
static const SettingVariant _currency_settings[] = {
static const SettingVariant _currency_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -14,9 +14,8 @@
; be saved in their new place.
[pre-amble]
static const uint GAME_DIFFICULTY_NUM = 18;
static const std::array<std::string, GAME_DIFFICULTY_NUM> _old_diff_settings{"max_no_competitors", "competitor_start_time", "number_towns", "industry_density", "max_loan", "initial_interest", "vehicle_costs", "competitor_speed", "competitor_intelligence", "vehicle_breakdowns", "subsidy_multiplier", "construction_cost", "terrain_type", "quantity_sea_lakes", "economy", "line_reverse_mode", "disasters", "town_council_tolerance"};
static uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
const std::array<std::string, GAME_DIFFICULTY_NUM> _old_diff_settings{"max_no_competitors", "competitor_start_time", "number_towns", "industry_density", "max_loan", "initial_interest", "vehicle_costs", "competitor_speed", "competitor_intelligence", "vehicle_breakdowns", "subsidy_multiplier", "construction_cost", "terrain_type", "quantity_sea_lakes", "economy", "line_reverse_mode", "disasters", "town_council_tolerance"};
uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
uint8 _old_diff_level; ///< Old difficulty level from old savegames
uint8 _old_units; ///< Old units from old savegames
@@ -33,7 +32,7 @@ static std::initializer_list<const char*> _osk_activation{"disabled", "double",
static std::initializer_list<const char*> _settings_profiles{"easy", "medium", "hard"};
static std::initializer_list<const char*> _news_display{ "off", "summarized", "full"};
static const SettingVariant _gameopt_settings[] = {
static const SettingVariant _gameopt_settings_table[] = {
/* 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

View File

@@ -20,7 +20,7 @@ extern bool _allow_hidpi_window;
#define WITHOUT_COCOA
#endif
static const SettingVariant _misc_settings[] = {
static const SettingVariant _misc_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -7,7 +7,7 @@
; Network settings as stored in the private configuration file ("private.cfg").
[pre-amble]
static const SettingVariant _network_private_settings[] = {
static const SettingVariant _network_private_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -9,7 +9,7 @@
[pre-amble]
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval);
static const SettingVariant _network_secrets_settings[] = {
static const SettingVariant _network_secrets_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -9,7 +9,7 @@
[pre-amble]
static void UpdateClientConfigValues();
static const SettingVariant _network_settings[] = {
static const SettingVariant _network_settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -46,7 +46,7 @@ static void InvalidateShipPathCache(int32 new_value);
* 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. */
static const SettingVariant _settings[] = {
static const SettingVariant _settings_table[] = {
[post-amble]
};
[templates]

View File

@@ -12,7 +12,7 @@
#if defined(_WIN32) && !defined(DEDICATED)
extern bool _window_maximize;
static const SettingVariant _win32_settings[] = {
static const SettingVariant _win32_settings_table[] = {
[post-amble]
};
#endif /* _WIN32 */

View File

@@ -9,7 +9,7 @@
[pre-amble]
static const SettingVariant _window_settings[] = {
static const SettingVariant _window_settings_table[] = {
[post-amble]
};
[templates]