diff options
author | frosch <frosch@openttd.org> | 2011-07-31 14:13:01 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-07-31 14:13:01 +0000 |
commit | 536fc4246189cb13a8848dc71bedc00a79c7031a (patch) | |
tree | 6107b31a3277af336ceef93c1bd2deb06caf569a /src/economy.cpp | |
parent | ae8f53a4030fde1af599e1dddd05f57b9a386bae (diff) | |
download | openttd-536fc4246189cb13a8848dc71bedc00a79c7031a.tar.xz |
(svn r22707) -Codechange: Simplify applying the difficulty settings to prices, and reduce computational errors. (Eddi)
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index a55b6c934..c1ea31045 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -652,17 +652,18 @@ void RecomputePrices() default: break; } - if (mod < 1) { - price = price * 3 >> 2; - } else if (mod > 1) { - price = price * 9 >> 3; + switch (mod) { + case 0: price *= 6; break; + case 1: price *= 8; break; // normalised to 1 below + case 2: price *= 9; break; + default: NOT_REACHED(); } /* Apply inflation */ price = (int64)price * _economy.inflation_prices; - /* Apply newgrf modifiers, and remove fractional part of inflation */ - int shift = _price_base_multiplier[i] - 16; + /* Apply newgrf modifiers, remove fractional part of inflation, and normalise on medium difficulty. */ + int shift = _price_base_multiplier[i] - 16 - 3; if (shift >= 0) { price <<= shift; } else { |