From 4fb0f9bacc29aaf333c719ff6a409288bc7024fa Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 7 Aug 2015 23:23:27 +0100 Subject: [PATCH] SPP loader: Adjust inflation cost scaling on load. SpringPP divides all prices by the difficulty factor, effectively making things about 8 times cheaper. Adjust the inflation factor to compensate for this, as otherwise the game is unplayable on load if inflation has been running for a while. To avoid making things too cheap, clamp the price inflation factor to no lower than the payment inflation factor. --- src/saveload/afterload.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 1b0badcc51..ca7bddba4e 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3057,6 +3057,25 @@ bool AfterLoadGame() } } + if (SlXvIsFeaturePresent(XSLFI_SPRINGPP)) { + /* + * Cost scaling changes: + * SpringPP divides all prices by the difficulty factor, effectively making things about 8 times cheaper. + * Adjust the inflation factor to compensate for this, as otherwise the game is unplayable on load if inflation has been running for a while. + * To avoid making things too cheap, clamp the price inflation factor to no lower than the payment inflation factor. + */ + + DEBUG(sl, 3, "Inflation prices: %f", _economy.inflation_prices / 65536.0); + DEBUG(sl, 3, "Inflation payments: %f", _economy.inflation_payment / 65536.0); + + _economy.inflation_prices >>= 3; + if (_economy.inflation_prices < _economy.inflation_payment) { + _economy.inflation_prices = _economy.inflation_payment; + } + + DEBUG(sl, 3, "New inflation prices: %f", _economy.inflation_prices / 65536.0); + } + /* Station acceptance is some kind of cache */ if (IsSavegameVersionBefore(127)) { Station *st;