summaryrefslogtreecommitdiff
path: root/src/saveload/afterload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r--src/saveload/afterload.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index be6be8de6..d4b230dfd 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -3127,6 +3127,23 @@ bool AfterLoadGame()
}
}
+ if (IsSavegameVersionBefore(SLV_GROUP_REPLACE_WAGON_REMOVAL)) {
+ /* Propagate wagon removal flag for compatibility */
+ /* Temporary bitmask of company wagon removal setting */
+ uint16 wagon_removal = 0;
+ for (const Company *c : Company::Iterate()) {
+ if (c->settings.renew_keep_length) SetBit(wagon_removal, c->index);
+ }
+ for (Group *g : Group::Iterate()) {
+ if (g->flags != 0) {
+ /* Convert old replace_protection value to flag. */
+ g->flags = 0;
+ SetBit(g->flags, GroupFlags::GF_REPLACE_PROTECTION);
+ }
+ if (HasBit(wagon_removal, g->owner)) SetBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
+ }
+ }
+
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
Station::RecomputeCatchmentForAll();