diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2018-11-07 19:06:39 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-03-04 20:19:44 +0100 |
commit | 52572cafa62b1ab2f095f8a6d7db23f5d0fa618e (patch) | |
tree | 576afdf38e049815a7227d836354dce4260e041e /src/saveload | |
parent | 7f00a420cbd2e4311a34937bc33966981b0ef5e5 (diff) | |
download | openttd-52572cafa62b1ab2f095f8a6d7db23f5d0fa618e.tar.xz |
Add: Option for population-linear town cargo generation
Introduce a new default algorithm for town cargo generation (passengers and mail), and a game setting to choose between the new and original algorithm.
The original town cargo generation algorithm has the property of the generated amount relating to the square of each building's population, meaning large towns easily produce more cargo than can realistically be transported. The problem is excessive cargo is amplified if playing with cargodist.
The new algorithm introduced instead has a linear relation to the population. The result is that smaller towns will produce slightly more cargo, while the largest towns will produce about a fourth of what they would with the original algorithm.
Existing savegames will use the original algorithm, while new games will default to the new algorithm.
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 5 | ||||
-rw-r--r-- | src/saveload/saveload.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 0b570966d..55552413a 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3080,6 +3080,11 @@ bool AfterLoadGame() } } + if (IsSavegameVersionBefore(SLV_TOWN_CARGOGEN)) { + /* Ensure the original cargo generation mode is used */ + _settings_game.economy.town_cargogen_mode = TCGM_ORIGINAL; + } + /* Station acceptance is some kind of cache */ if (IsSavegameVersionBefore(SLV_127)) { Station *st; diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index c5e7489c1..36c9687ea 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -291,6 +291,7 @@ enum SaveLoadVersion : uint16 { SLV_GROUP_LIVERIES, ///< 205 PR#7108 Livery storage change and group liveries. SLV_SHIPS_STOP_IN_LOCKS, ///< 206 PR#7150 Ship/lock movement changes. SLV_FIX_CARGO_MONITOR, ///< 207 PR#7175 v1.9 Cargo monitor data packing fix to support 64 cargotypes. + SLV_TOWN_CARGOGEN, ///< 208 PR#6965 New algorithms for town building cargo generation. SL_MAX_VERSION, ///< Highest possible saveload version }; |