summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorPavel Stupnikov <dp@dpointer.org>2020-12-22 16:29:48 +0300
committerGitHub <noreply@github.com>2020-12-22 14:29:48 +0100
commit9a45a0f535e312cd97db12c3a2ec1068fa381136 (patch)
treeeb4f235933ea178c370c04c9b12cd00b005f4644 /src/saveload
parentb7751c483e5545aa683baf0b9f09a0add34cfefd (diff)
downloadopenttd-9a45a0f535e312cd97db12c3a2ec1068fa381136.tar.xz
Feature: Set exclusive access to industry from GS (#8115)
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp8
-rw-r--r--src/saveload/industry_sl.cpp2
-rw-r--r--src/saveload/saveload.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 7d1e70212..c617348d7 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -3125,6 +3125,14 @@ bool AfterLoadGame()
}
}
+ /* Make sure all industries exclusive supplier/consumer set correctly. */
+ if (IsSavegameVersionBefore(SLV_GS_INDUSTRY_CONTROL)) {
+ for (Industry *i : Industry::Iterate()) {
+ i->exclusive_supplier = INVALID_OWNER;
+ i->exclusive_consumer = INVALID_OWNER;
+ }
+ }
+
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
Station::RecomputeCatchmentForAll();
diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp
index 8f7301120..99e25856c 100644
--- a/src/saveload/industry_sl.cpp
+++ b/src/saveload/industry_sl.cpp
@@ -64,6 +64,8 @@ static const SaveLoad _industry_desc[] = {
SLE_CONDVAR(Industry, last_cargo_accepted_at[0], SLE_INT32, SLV_70, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
SLE_CONDARR(Industry, last_cargo_accepted_at, SLE_INT32, 16, SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
SLE_CONDVAR(Industry, selected_layout, SLE_UINT8, SLV_73, SL_MAX_VERSION),
+ SLE_CONDVAR(Industry, exclusive_supplier, SLE_UINT8, SLV_GS_INDUSTRY_CONTROL, SL_MAX_VERSION),
+ SLE_CONDVAR(Industry, exclusive_consumer, SLE_UINT8, SLV_GS_INDUSTRY_CONTROL, SL_MAX_VERSION),
SLEG_CONDARR(_old_ind_persistent_storage.storage, SLE_UINT32, 16, SLV_76, SLV_161),
SLE_CONDREF(Industry, psa, REF_STORAGE, SLV_161, SL_MAX_VERSION),
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 0b525570d..58a291932 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -320,7 +320,7 @@ enum SaveLoadVersion : uint16 {
SLV_START_PATCHPACKS, ///< 220 First known patchpack to use a version just above ours.
SLV_END_PATCHPACKS = 286, ///< 286 Last known patchpack to use a version just above ours.
- SLV_GS_INDUSTRY_CONTROL, ///< 287 PR#7912 GS industry control.
+ SLV_GS_INDUSTRY_CONTROL, ///< 287 PR#7912 and PR#8115 GS industry control.
SL_MAX_VERSION, ///< Highest possible saveload version
};