mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r24565) -Fix: Stop both price and payment inflation if either of them has reached MAX_INFLATION.
This commit is contained in:
parent
7122602026
commit
0ba2ed7676
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ Money GetPrice(Price index, uint cost_factor, const struct GRFFile *grf_file, in
|
|||
|
||||
void InitializeEconomy();
|
||||
void RecomputePrices();
|
||||
void AddInflation(bool check_year = true);
|
||||
bool AddInflation(bool check_year = true);
|
||||
|
||||
/**
|
||||
* Is the economy in recession?
|
||||
|
|
|
@ -2171,7 +2171,7 @@ bool AfterLoadGame()
|
|||
|
||||
/* Simulate the inflation, so we also get the payment inflation */
|
||||
while (_economy.inflation_prices < aimed_inflation) {
|
||||
AddInflation(false);
|
||||
if (AddInflation(false)) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue