(svn r24605) [1.2] -Backport from trunk:

- Fix: Naming of bundles was somewhat broken (r24569)
- Fix: Non-train vehicle lists were not resorted when vehicles were renamed [FS#5261] (r24567)
- Fix: Stop both price and payment inflation if either of them has reached MAX_INFLATION (r24565)
- Fix: Limiting the inflation did not quite work [FS#5312] (r24564)
This commit is contained in:
rubidium 2012-10-17 19:04:07 +00:00
parent 962d418d5b
commit 98dfb55e54
6 changed files with 21 additions and 12 deletions

View File

@ -10,13 +10,9 @@
#
# The revision is needed for the bundle name and creating an OSX application bundle.
ifdef REVISION
REV := $(REVISION)
else
# Detect the revision
VERSIONS := $(shell AWK="$(AWK)" "$(ROOT_DIR)/findversion.sh")
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
endif
# Make sure we have something in REV
ifeq ($(REV),)

View File

@ -41,7 +41,6 @@ TTDS = $(SRC_DIRS:%=%/$(TTD))
OS = !!OS!!
OSXAPP = !!OSXAPP!!
LIPO = !!LIPO!!
REVISION = !!REVISION!!
AWK = !!AWK!!
SORT = !!SORT!!
DISTCC = !!DISTCC!!

View File

@ -650,8 +650,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
@ -668,15 +669,22 @@ 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
* 12 -> months per year
* This is only a good approxiamtion for small values
*/
_economy.inflation_prices += min((_economy.inflation_prices * _economy.infl_amount * 54) >> 16, MAX_INFLATION);
_economy.inflation_payment += min((_economy.inflation_payment * _economy.infl_amount_pr * 54) >> 16, MAX_INFLATION);
_economy.inflation_prices += (_economy.inflation_prices * _economy.infl_amount * 54) >> 16;
_economy.inflation_payment += (_economy.inflation_payment * _economy.infl_amount_pr * 54) >> 16;
if (_economy.inflation_prices > MAX_INFLATION) _economy.inflation_prices = MAX_INFLATION;
if (_economy.inflation_payment > MAX_INFLATION) _economy.inflation_payment = MAX_INFLATION;
return false;
}
/**

View File

@ -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?

View File

@ -2167,7 +2167,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;
}
}
@ -2732,6 +2732,12 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(177)) {
/* Fix too high inflation rates */
if (_economy.inflation_prices > MAX_INFLATION) _economy.inflation_prices = MAX_INFLATION;
if (_economy.inflation_payment > MAX_INFLATION) _economy.inflation_payment = MAX_INFLATION;
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();

View File

@ -1017,7 +1017,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (flags & DC_EXEC) {
free(v->name);
v->name = reset ? NULL : strdup(text);
InvalidateWindowClassesData(WC_TRAINS_LIST, 1);
InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 1);
MarkWholeScreenDirty();
}