summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-10-01 19:31:55 +0000
committerfrosch <frosch@openttd.org>2012-10-01 19:31:55 +0000
commit0ba2ed7676b954511fd2c17f450ae1618b1a677c (patch)
treeb4388f02c5ff87b9f2e14963abb51e488bf5cf30 /src/economy.cpp
parent712260202660ffaf19342b43c0b34cd2e2093434 (diff)
downloadopenttd-0ba2ed7676b954511fd2c17f450ae1618b1a677c.tar.xz
(svn r24565) -Fix: Stop both price and payment inflation if either of them has reached MAX_INFLATION.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 5026e0127..6ef7636aa 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -651,8 +651,9 @@ static void CompaniesGenStatistics()
/**
* Add monthly inflation
* @param check_year Shall the inflation get stopped after 170 years?
+ * @return true if inflation is maxed and nothing was changed
*/
-void AddInflation(bool check_year)
+bool AddInflation(bool check_year)
{
/* The cargo payment inflation differs from the normal inflation, so the
* relative amount of money you make with a transport decreases slowly over
@@ -669,7 +670,9 @@ void 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;
+ 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;
/* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
* scaled by 65536
@@ -681,6 +684,8 @@ void AddInflation(bool check_year)
if (_economy.inflation_prices > MAX_INFLATION) _economy.inflation_prices = MAX_INFLATION;
if (_economy.inflation_payment > MAX_INFLATION) _economy.inflation_payment = MAX_INFLATION;
+
+ return false;
}
/**