Change: Don't save industry history if cargo slot isn't used. (#11133)

This avoids saving history of 16 slots per industry when in many cases (NewGRF dependent) only a couple are used.
This commit is contained in:
PeterN 2023-07-14 11:12:22 +01:00 committed by GitHub
parent 3ac663e619
commit c3d1264a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -67,6 +67,12 @@ public:
void Save(Industry::ProducedCargo *p) const override
{
if (!IsValidCargoID(p->cargo)) {
/* Don't save any history if cargo slot isn't used. */
SlSetStructListLength(0);
return;
}
SlSetStructListLength(p->history.size());
for (auto &h : p->history) {