From e17c6da46a5d4e26b929a00c77bbefdf84963a13 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 17 Apr 2024 17:35:01 +0100 Subject: [PATCH] Fix industry cargoes when loading newer vanilla savegames --- src/saveload/industry_sl.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp index 321035ff86..a3b779a323 100644 --- a/src/saveload/industry_sl.cpp +++ b/src/saveload/industry_sl.cpp @@ -64,6 +64,10 @@ public: { size_t len = SlGetStructListLength(INDUSTRY_NUM_INPUTS); + for (size_t j = 0; j < INDUSTRY_NUM_INPUTS; j++) { + i->accepts_cargo[j] = INVALID_CARGO; + } + for (size_t j = 0; j < len; j++) { AcceptedCargo a = {}; SlObject(&a, this->GetDescription()); @@ -119,6 +123,17 @@ public: { size_t len = SlGetStructListLength(INDUSTRY_NUM_OUTPUTS); + for (size_t j = 0; j < INDUSTRY_NUM_OUTPUTS; j++) { + i->produced_cargo[j] = INVALID_CARGO; + i->produced_cargo_waiting[j] = 0; + i->production_rate[j] = 0; + i->this_month_production[j] = 0; + i->this_month_transported[j] = 0; + i->last_month_production[j] = 0; + i->last_month_transported[j] = 0; + i->last_month_pct_transported[j] = 0; + } + for (size_t j = 0; j < len; j++) { ProducedCargo p = {}; SlObject(&p, this->GetDescription());