; This file is part of OpenTTD. ; OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. ; OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . ; ; Difficulty settings as stored in the main configuration file ("openttd.cfg") ; and in the savegame PATS chunk. [pre-amble] const std::array _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_t _old_diff_custom[GAME_DIFFICULTY_NUM]; uint8_t _old_diff_level; ///< Old difficulty level from old savegames static void DifficultyNoiseChange(int32_t new_value); static void MaxNoAIsChange(int32_t new_value); static const SettingVariant _difficulty_settings_table[] = { [post-amble] }; [templates] SDTG_VAR = SDTG_VAR($name, $type, $flags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $str_cb, $help_cb, $val_cb, $from, $to, $cat, $extra, $startup), SDT_BOOL = SDT_BOOL(GameSettings, $var, $flags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $str_cb, $help_cb, $val_cb, $from, $to, $cat, $extra, $startup), SDT_VAR = SDT_VAR(GameSettings, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $str_cb, $help_cb, $val_cb, $from, $to, $cat, $extra, $startup), [validation] SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size"); SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size"); [defaults] flags = SF_NONE interval = 0 str = STR_NULL strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT strval = STR_NULL pre_cb = nullptr post_cb = nullptr str_cb = nullptr help_cb = nullptr val_cb = nullptr load = nullptr from = SL_MIN_VERSION to = SL_MAX_VERSION cat = SC_ADVANCED extra = 0 startup = false ; Saved settings variables. ; The next 18 entries are important for savegame compatibility. Do NOT remove those. See HandleOldDiffCustom() for more details. [SDT_VAR] var = difficulty.max_no_competitors type = SLE_UINT8 from = SLV_97 def = 0 min = 0 max = MAX_COMPANIES - 1 interval = 1 post_cb = MaxNoAIsChange cat = SC_BASIC [SDT_VAR] var = difficulty.competitors_interval type = SLE_UINT16 from = SLV_AI_START_DATE def = 10 min = MIN_COMPETITORS_INTERVAL max = MAX_COMPETITORS_INTERVAL interval = 1 [SDT_VAR] var = difficulty.competitor_start_time type = SLE_UINT8 from = SLV_97 to = SLV_110 def = 2 min = 0 max = 3 [SDT_VAR] var = difficulty.number_towns type = SLE_UINT8 from = SLV_97 flags = SF_NEWGAME_ONLY def = 2 min = 0 max = 4 interval = 1 strval = STR_NUM_VERY_LOW cat = SC_BASIC [SDT_VAR] var = difficulty.industry_density type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN def = ID_NORMAL min = 0 max = ID_END - 1 interval = 1 str = STR_CONFIG_SETTING_INDUSTRY_DENSITY strhelp = STR_CONFIG_SETTING_INDUSTRY_DENSITY_HELPTEXT strval = STR_FUNDING_ONLY cat = SC_BASIC [SDT_VAR] var = difficulty.max_loan type = SLE_UINT32 from = SLV_97 flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_CURRENCY | SF_GUI_0_IS_SPECIAL def = 300000 min = LOAN_INTERVAL max = MAX_LOAN_LIMIT pre_cb = [](auto &new_value) { new_value = (new_value + LOAN_INTERVAL / 2) / LOAN_INTERVAL * LOAN_INTERVAL; return true; } interval = LOAN_INTERVAL str = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN strhelp = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT strval = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_VALUE cat = SC_BASIC [SDT_VAR] var = difficulty.initial_interest type = SLE_UINT8 from = SLV_97 flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO def = 2 min = 2 max = 4 interval = 1 str = STR_CONFIG_SETTING_INTEREST_RATE strhelp = STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT strval = STR_CONFIG_SETTING_PERCENTAGE [SDT_VAR] var = difficulty.vehicle_costs type = SLE_UINT8 from = SLV_97 flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_DROPDOWN def = 0 min = 0 max = 2 interval = 1 str = STR_CONFIG_SETTING_RUNNING_COSTS strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT strval = STR_SEA_LEVEL_LOW cat = SC_BASIC [SDT_VAR] var = difficulty.competitor_speed type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN def = 2 min = 0 max = 4 interval = 1 str = STR_CONFIG_SETTING_CONSTRUCTION_SPEED strhelp = STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT strval = STR_AI_SPEED_VERY_SLOW cat = SC_BASIC [SDT_VAR] var = difficulty.competitor_intelligence type = SLE_UINT8 from = SLV_97 to = SLV_110 def = 0 min = 0 max = 2 [SDT_VAR] var = difficulty.vehicle_breakdowns type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN def = 1 min = 0 max = 2 interval = 1 str = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS strhelp = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT strval = STR_DISASTER_NONE cat = SC_BASIC [SDT_VAR] var = difficulty.subsidy_multiplier type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN def = 2 min = 0 max = 3 interval = 1 str = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER strhelp = STR_CONFIG_SETTING_SUBSIDY_MULTIPLIER_HELPTEXT strval = STR_SUBSIDY_X1_5 [SDT_VAR] var = difficulty.subsidy_duration type = SLE_UINT16 from = SLV_CUSTOM_SUBSIDY_DURATION flags = SF_GUI_0_IS_SPECIAL def = 1 min = 0 max = 5000 interval = 1 str = STR_CONFIG_SETTING_SUBSIDY_DURATION strhelp = STR_CONFIG_SETTING_SUBSIDY_DURATION_HELPTEXT help_cb = SettingHelpWallclock strval = STR_CONFIG_SETTING_SUBSIDY_DURATION_VALUE [SDT_VAR] var = difficulty.construction_cost type = SLE_UINT8 from = SLV_97 flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_DROPDOWN def = 0 min = 0 max = 2 interval = 1 str = STR_CONFIG_SETTING_CONSTRUCTION_COSTS strhelp = STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT strval = STR_SEA_LEVEL_LOW cat = SC_BASIC [SDT_VAR] var = difficulty.terrain_type type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY def = 1 min = 0 max = 5 interval = 1 str = STR_CONFIG_SETTING_TERRAIN_TYPE strhelp = STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT strval = STR_TERRAIN_TYPE_VERY_FLAT cat = SC_BASIC [SDT_VAR] var = difficulty.quantity_sea_lakes type = SLE_UINT8 from = SLV_97 flags = SF_NEWGAME_ONLY def = 0 min = 0 max = 4 interval = 1 strval = STR_SEA_LEVEL_VERY_LOW cat = SC_BASIC [SDT_BOOL] var = difficulty.economy from = SLV_97 def = false str = STR_CONFIG_SETTING_RECESSIONS strhelp = STR_CONFIG_SETTING_RECESSIONS_HELPTEXT [SDT_BOOL] var = difficulty.line_reverse_mode from = SLV_97 def = false str = STR_CONFIG_SETTING_TRAIN_REVERSING strhelp = STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT [SDT_BOOL] var = difficulty.disasters from = SLV_97 def = false str = STR_CONFIG_SETTING_DISASTERS strhelp = STR_CONFIG_SETTING_DISASTERS_HELPTEXT cat = SC_BASIC [SDT_VAR] var = difficulty.town_council_tolerance type = SLE_UINT8 from = SLV_97 flags = SF_GUI_DROPDOWN def = 0 min = 0 max = 3 interval = 1 str = STR_CONFIG_SETTING_CITY_APPROVAL strhelp = STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT strval = STR_CITY_APPROVAL_LENIENT post_cb = DifficultyNoiseChange [SDTG_VAR] name = ""diff_level"" var = _old_diff_level type = SLE_UINT8 flags = SF_NOT_IN_CONFIG from = SLV_97 to = SLV_178 def = 3 min = 0 max = 3 cat = SC_BASIC [SDT_BOOL] var = difficulty.infinite_money def = false str = STR_CONFIG_SETTING_INFINITE_MONEY strhelp = STR_CONFIG_SETTING_INFINITE_MONEY_HELPTEXT cat = SC_BASIC post_cb = [](auto) { SetWindowDirty(WC_STATUS_BAR, 0); }