Changeset - r17893:8f23c9864735
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2011-07-31 14:13:01
frosch@openttd.org
(svn r22707) -Codechange: Simplify applying the difficulty settings to prices, and reduce computational errors. (Eddi)
1 file changed with 7 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -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 {
0 comments (0 inline, 0 general)