summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-02-11 20:54:49 +0000
committeryexo <yexo@openttd.org>2011-02-11 20:54:49 +0000
commit296af357411e20ccaacf4c78dc0f36da1fae0a65 (patch)
treed35a46b5cb767e5533093b882b3b19e4ef734e79 /src/saveload
parent37483180e8b251b0a882ea193d02d6ef76879ee9 (diff)
downloadopenttd-296af357411e20ccaacf4c78dc0f36da1fae0a65.tar.xz
(svn r22061) -Change: when loading old savegames with long trains set the maximum train length to the length of the longest train
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index fe99e3c3e..c2ac41638 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2580,6 +2580,11 @@ bool AfterLoadGame()
* disable anything at all. So, if some reversing was disabled we
* will keep reversing disabled, otherwise it'll be turned on. */
_settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255);
+
+ Train *t;
+ FOR_ALL_TRAINS(t) {
+ _settings_game.vehicle.max_train_length = max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
+ }
}
if (IsSavegameVersionBefore(160)) {