diff options
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 21 | ||||
-rw-r--r-- | src/saveload/industry_sl.cpp | 30 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 3 |
3 files changed, 43 insertions, 11 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index cca9ad328..1529aca2b 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3015,6 +3015,27 @@ bool AfterLoadGame() } } + if (IsSavegameVersionBefore(202)) { + /* Make sure added industry cargo slots are cleared */ + Industry *i; + FOR_ALL_INDUSTRIES(i) { + for (size_t ci = 2; ci < lengthof(i->produced_cargo); ci++) { + i->produced_cargo[ci] = CT_INVALID; + i->produced_cargo_waiting[ci] = 0; + i->production_rate[ci] = 0; + i->last_month_production[ci] = 0; + i->last_month_transported[ci] = 0; + i->last_month_pct_transported[ci] = 0; + i->this_month_production[ci] = 0; + i->this_month_transported[ci] = 0; + } + for (size_t ci = 3; ci < lengthof(i->accepts_cargo); ci++) { + i->accepts_cargo[ci] = CT_INVALID; + i->incoming_cargo_waiting[ci] = 0; + } + } + } + /* Station acceptance is some kind of cache */ if (IsSavegameVersionBefore(127)) { Station *st; diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp index 615e8e152..9727e4e51 100644 --- a/src/saveload/industry_sl.cpp +++ b/src/saveload/industry_sl.cpp @@ -26,18 +26,28 @@ static const SaveLoad _industry_desc[] = { SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16), SLE_REF(Industry, town, REF_TOWN), SLE_CONDNULL( 2, 0, 60), ///< used to be industry's produced_cargo - SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, SL_MAX_VERSION), - SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, SL_MAX_VERSION), - SLE_ARR(Industry, produced_cargo_waiting, SLE_UINT16, 2), - SLE_ARR(Industry, production_rate, SLE_UINT8, 2), + SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, 201), + SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, 201), + SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, production_rate, SLE_UINT8, 2, 0, 201), + SLE_CONDARR(Industry, production_rate, SLE_UINT8, 16, 202, SL_MAX_VERSION), SLE_CONDNULL( 3, 0, 60), ///< used to be industry's accepts_cargo - SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, SL_MAX_VERSION), + SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, 201), + SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION), SLE_VAR(Industry, prod_level, SLE_UINT8), - SLE_ARR(Industry, this_month_production, SLE_UINT16, 2), - SLE_ARR(Industry, this_month_transported, SLE_UINT16, 2), - SLE_ARR(Industry, last_month_pct_transported, SLE_UINT8, 2), - SLE_ARR(Industry, last_month_production, SLE_UINT16, 2), - SLE_ARR(Industry, last_month_transported, SLE_UINT16, 2), + SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 2, 0, 201), + SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION), SLE_VAR(Industry, counter, SLE_UINT16), diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index f23d13a08..8cf5ee36b 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -269,8 +269,9 @@ * 199 * 200 #6805 Extend railtypes to 64, adding uint16 to map array. * 201 #6885 Extend NewGRF persistant storages. + * 202 #6867 Increase industry cargo slots to 16 in, 16 out */ -extern const uint16 SAVEGAME_VERSION = 201; ///< Current savegame version of OpenTTD. +extern const uint16 SAVEGAME_VERSION = 202; ///< Current savegame version of OpenTTD. SavegameType _savegame_type; ///< type of savegame we are loading FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop. |