summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-12-25 20:36:14 +0100
committerGitHub <noreply@github.com>2020-12-25 20:36:14 +0100
commit79cb9efa7f7adb250fd25bee2200165ddd77817e (patch)
tree1738157692448325abf6a9428e38aa231bfbc364
parente6e91a345c1d802f0bb1da04e1d6f4ed843e4c8a (diff)
downloadopenttd-79cb9efa7f7adb250fd25bee2200165ddd77817e.tar.xz
Change: Always apply inflation from 1920 to 2090, no matter the game start year. (#7589)
-rw-r--r--src/economy.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 5e53334a0..3af220d96 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -722,7 +722,7 @@ bool AddInflation(bool check_year)
* inflation doesn't add anything after that either; it even makes playing
* it impossible due to the diverging cost and income rates.
*/
- if (check_year && (_cur_year - _settings_game.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return true;
+ if (check_year && (_cur_year < ORIGINAL_BASE_YEAR || _cur_year >= ORIGINAL_MAX_YEAR)) return true;
if (_economy.inflation_prices == MAX_INFLATION || _economy.inflation_payment == MAX_INFLATION) return true;
@@ -914,6 +914,14 @@ void StartupEconomy()
_economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1);
_economy.fluct = GB(Random(), 0, 8) + 168;
+ if (_settings_game.economy.inflation) {
+ /* Apply inflation that happened before our game start year. */
+ int months = (min(_cur_year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12;
+ for (int i = 0; i < months; i++) {
+ AddInflation(false);
+ }
+ }
+
/* Set up prices */
RecomputePrices();