(svn r22707) -Codechange: Simplify applying the difficulty settings to prices, and reduce computational errors. (Eddi)

This commit is contained in:
frosch 2011-07-31 14:13:01 +00:00
parent ae8f53a403
commit 536fc42461

View File

@ -652,17 +652,18 @@ void RecomputePrices()
default: break; default: break;
} }
if (mod < 1) { switch (mod) {
price = price * 3 >> 2; case 0: price *= 6; break;
} else if (mod > 1) { case 1: price *= 8; break; // normalised to 1 below
price = price * 9 >> 3; case 2: price *= 9; break;
default: NOT_REACHED();
} }
/* Apply inflation */ /* Apply inflation */
price = (int64)price * _economy.inflation_prices; price = (int64)price * _economy.inflation_prices;
/* Apply newgrf modifiers, and remove fractional part of inflation */ /* Apply newgrf modifiers, remove fractional part of inflation, and normalise on medium difficulty. */
int shift = _price_base_multiplier[i] - 16; int shift = _price_base_multiplier[i] - 16 - 3;
if (shift >= 0) { if (shift >= 0) {
price <<= shift; price <<= shift;
} else { } else {