summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-09-05 19:02:34 +0000
committersmatz <smatz@openttd.org>2009-09-05 19:02:34 +0000
commit1776a4ecc100cede5f99d49c8fee3e28d01d9cd7 (patch)
tree762f10382611e42c934e06f722d2fd43789b5d21 /src/economy.cpp
parent19ebfc84f7a760eedc73e844242f9da1a629bc64 (diff)
downloadopenttd-1776a4ecc100cede5f99d49c8fee3e28d01d9cd7.tar.xz
(svn r17426) -Fix (r1): economy recession would never end when economy is set to Steady while in recession
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 4e8bbc252..5559d61a5 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -674,9 +674,18 @@ static void CompaniesPayInterest()
static void HandleEconomyFluctuations()
{
- if (_settings_game.difficulty.economy == 0) return;
+ if (_settings_game.difficulty.economy != 0) {
+ /* When economy is Fluctuating, decrease counter */
+ _economy.fluct--;
+ } else if (_economy.fluct <= 0) {
+ /* When it's Steady and we are in recession, end it now */
+ _economy.fluct = -12;
+ } else {
+ /* No need to do anything else in other cases */
+ return;
+ }
- if (--_economy.fluct == 0) {
+ if (_economy.fluct == 0) {
_economy.fluct = -(int)GB(Random(), 0, 2);
AddNewsItem(STR_NEWS_BEGIN_OF_RECESSION, NS_ECONOMY);
} else if (_economy.fluct == -12) {