Add setting for inflation dates mode
This commit is contained in:
@@ -768,7 +768,11 @@ bool AddInflation(bool check_year)
|
|||||||
* inflation doesn't add anything after that either; it even makes playing
|
* inflation doesn't add anything after that either; it even makes playing
|
||||||
* it impossible due to the diverging cost and income rates.
|
* it impossible due to the diverging cost and income rates.
|
||||||
*/
|
*/
|
||||||
|
if (_settings_game.economy.inflation_fixed_dates) {
|
||||||
if (check_year && (_cur_year < ORIGINAL_BASE_YEAR || _cur_year >= ORIGINAL_MAX_YEAR)) return true;
|
if (check_year && (_cur_year < ORIGINAL_BASE_YEAR || _cur_year >= ORIGINAL_MAX_YEAR)) return true;
|
||||||
|
} else {
|
||||||
|
if (check_year && (_cur_year - _settings_game.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (_economy.inflation_prices == MAX_INFLATION || _economy.inflation_payment == MAX_INFLATION) return true;
|
if (_economy.inflation_prices == MAX_INFLATION || _economy.inflation_payment == MAX_INFLATION) return true;
|
||||||
|
|
||||||
@@ -960,7 +964,7 @@ void StartupEconomy()
|
|||||||
_economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1);
|
_economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1);
|
||||||
_economy.fluct = GB(Random(), 0, 8) + 168;
|
_economy.fluct = GB(Random(), 0, 8) + 168;
|
||||||
|
|
||||||
if (_settings_game.economy.inflation) {
|
if (_settings_game.economy.inflation && _settings_game.economy.inflation_fixed_dates) {
|
||||||
/* Apply inflation that happened before our game start year. */
|
/* Apply inflation that happened before our game start year. */
|
||||||
int months = (min(_cur_year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12;
|
int months = (min(_cur_year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12;
|
||||||
for (int i = 0; i < months; i++) {
|
for (int i = 0; i < months; i++) {
|
||||||
|
@@ -1248,6 +1248,8 @@ STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :Allow to join s
|
|||||||
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Allow adding parts to a station without directly touching the existing parts. Needs Ctrl+Click while placing the new parts
|
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Allow adding parts to a station without directly touching the existing parts. Needs Ctrl+Click while placing the new parts
|
||||||
STR_CONFIG_SETTING_INFLATION :Inflation: {STRING2}
|
STR_CONFIG_SETTING_INFLATION :Inflation: {STRING2}
|
||||||
STR_CONFIG_SETTING_INFLATION_HELPTEXT :Enable inflation in the economy, where costs are slightly faster rising than payments
|
STR_CONFIG_SETTING_INFLATION_HELPTEXT :Enable inflation in the economy, where costs are slightly faster rising than payments
|
||||||
|
STR_CONFIG_SETTING_INFLATION_FIXED_DATES :Apply inflation from 1920 to 2090: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_INFLATION_FIXED_DATES_HELPTEXT :If enabled, inflation is always applied from 1920 to 2090, regardless of the game start date. This is the inflation model used since OpenTTD 1.11.{}If disabled, inflation is applied from the game start date for 170 years. This is the inflation model used until OpenTTD 1.10.
|
||||||
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH :Maximum bridge length: {STRING2}
|
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH :Maximum bridge length: {STRING2}
|
||||||
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH_HELPTEXT :Maximum length for building bridges
|
STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH_HELPTEXT :Maximum length for building bridges
|
||||||
STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT :Maximum bridge height: {STRING2}
|
STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT :Maximum bridge height: {STRING2}
|
||||||
|
@@ -3831,6 +3831,10 @@ bool AfterLoadGame()
|
|||||||
UpdateAllAnimatedTileSpeeds();
|
UpdateAllAnimatedTileSpeeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SlXvIsFeatureMissing(XSLFI_INFLATION_FIXED_DATES)) {
|
||||||
|
_settings_game.economy.inflation_fixed_dates = !IsSavegameVersionBefore(SLV_GS_INDUSTRY_CONTROL);
|
||||||
|
}
|
||||||
|
|
||||||
InitializeRoadGUI();
|
InitializeRoadGUI();
|
||||||
|
|
||||||
/* This needs to be done after conversion. */
|
/* This needs to be done after conversion. */
|
||||||
|
@@ -144,6 +144,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|||||||
{ XSLFI_NEWGRF_INFO_EXTRA, XSCF_NULL, 1, 1, "newgrf_info_extra", nullptr, nullptr, nullptr },
|
{ XSLFI_NEWGRF_INFO_EXTRA, XSCF_NULL, 1, 1, "newgrf_info_extra", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_INDUSTRY_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 1, 1, "industry_cargo_adj", nullptr, nullptr, nullptr },
|
{ XSLFI_INDUSTRY_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 1, 1, "industry_cargo_adj", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_REALISTIC_TRAIN_BRAKING,XSCF_NULL, 1, 1, "realistic_train_braking", nullptr, nullptr, "VLKA" },
|
{ XSLFI_REALISTIC_TRAIN_BRAKING,XSCF_NULL, 1, 1, "realistic_train_braking", nullptr, nullptr, "VLKA" },
|
||||||
|
{ XSLFI_INFLATION_FIXED_DATES, XSCF_IGNORABLE_ALL, 1, 1, "inflation_fixed_dates", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -98,6 +98,7 @@ enum SlXvFeatureIndex {
|
|||||||
XSLFI_NEWGRF_INFO_EXTRA, ///< Extra NewGRF info in savegame
|
XSLFI_NEWGRF_INFO_EXTRA, ///< Extra NewGRF info in savegame
|
||||||
XSLFI_INDUSTRY_CARGO_ADJ, ///< Industry cargo adjustment patch
|
XSLFI_INDUSTRY_CARGO_ADJ, ///< Industry cargo adjustment patch
|
||||||
XSLFI_REALISTIC_TRAIN_BRAKING, ///< Realistic train braking
|
XSLFI_REALISTIC_TRAIN_BRAKING, ///< Realistic train braking
|
||||||
|
XSLFI_INFLATION_FIXED_DATES, ///< Inflation is applied between fixed dates
|
||||||
|
|
||||||
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
||||||
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
||||||
|
@@ -1798,6 +1798,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
||||||
{
|
{
|
||||||
accounting->Add(new SettingEntry("economy.inflation"));
|
accounting->Add(new SettingEntry("economy.inflation"));
|
||||||
|
accounting->Add(new SettingEntry("economy.inflation_fixed_dates"));
|
||||||
accounting->Add(new SettingEntry("economy.day_length_factor"));
|
accounting->Add(new SettingEntry("economy.day_length_factor"));
|
||||||
accounting->Add(new SettingEntry("difficulty.initial_interest"));
|
accounting->Add(new SettingEntry("difficulty.initial_interest"));
|
||||||
accounting->Add(new SettingEntry("difficulty.max_loan"));
|
accounting->Add(new SettingEntry("difficulty.max_loan"));
|
||||||
|
@@ -571,6 +571,7 @@ struct VehicleSettings {
|
|||||||
/** Settings related to the economy. */
|
/** Settings related to the economy. */
|
||||||
struct EconomySettings {
|
struct EconomySettings {
|
||||||
bool inflation; ///< disable inflation
|
bool inflation; ///< disable inflation
|
||||||
|
bool inflation_fixed_dates; ///< whether inflation is applied between fixed dates
|
||||||
bool bribe; ///< enable bribing the local authority
|
bool bribe; ///< enable bribing the local authority
|
||||||
EconomyType type; ///< economy type (original/smooth/frozen)
|
EconomyType type; ///< economy type (original/smooth/frozen)
|
||||||
bool allow_shares; ///< allow the buying/selling of shares
|
bool allow_shares; ///< allow the buying/selling of shares
|
||||||
|
@@ -2029,6 +2029,14 @@ str = STR_CONFIG_SETTING_INFLATION
|
|||||||
strhelp = STR_CONFIG_SETTING_INFLATION_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_INFLATION_HELPTEXT
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
|
[SDT_BOOL]
|
||||||
|
base = GameSettings
|
||||||
|
var = economy.inflation_fixed_dates
|
||||||
|
def = true
|
||||||
|
str = STR_CONFIG_SETTING_INFLATION_FIXED_DATES
|
||||||
|
strhelp = STR_CONFIG_SETTING_INFLATION_FIXED_DATES_HELPTEXT
|
||||||
|
patxname = ""inflation_fixed_dates.economy.inflation_fixed_dates""
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = economy.day_length_factor
|
var = economy.day_length_factor
|
||||||
|
Reference in New Issue
Block a user