diff --git a/Makefile.bundle.in b/Makefile.bundle.in index 3c0b446005..64fb11ab77 100644 --- a/Makefile.bundle.in +++ b/Makefile.bundle.in @@ -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),) diff --git a/Makefile.in b/Makefile.in index d461086950..b947e436f6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -41,7 +41,6 @@ TTDS = $(SRC_DIRS:%=%/$(TTD)) OS = !!OS!! OSXAPP = !!OSXAPP!! LIPO = !!LIPO!! -REVISION = !!REVISION!! AWK = !!AWK!! SORT = !!SORT!! DISTCC = !!DISTCC!! diff --git a/src/economy.cpp b/src/economy.cpp index 2311015da7..09b2740368 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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; } /** diff --git a/src/economy_func.h b/src/economy_func.h index e9c9c170d7..111ce85a27 100644 --- a/src/economy_func.h +++ b/src/economy_func.h @@ -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? diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 7cb9f0ff07..a80a93035a 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -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(); diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index bfcdb68621..f0a0428ddc 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -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(); }