Fix: Do not pre-fill industry production history for unused production slots (#14730)

This commit is contained in:
Jonathan G Rennison
2025-10-24 20:34:35 +01:00
committed by dP
parent 34e3a8df44
commit b141d44362

View File

@@ -1835,13 +1835,13 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
if (indspec->callback_mask.Test(IndustryCallbackMask::Production256Ticks)) { if (indspec->callback_mask.Test(IndustryCallbackMask::Production256Ticks)) {
IndustryProductionCallback(i, 1); IndustryProductionCallback(i, 1);
for (auto &p : i->produced) { for (auto &p : i->produced) {
p.history[LAST_MONTH].production = ScaleByCargoScale(p.waiting * 8, false); if (IsValidCargoType(p.cargo)) p.history[LAST_MONTH].production = ScaleByCargoScale(p.waiting * 8, false);
p.waiting = 0; p.waiting = 0;
} }
} }
for (auto &p : i->produced) { for (auto &p : i->produced) {
p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false); if (IsValidCargoType(p.cargo)) p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false);
} }
UpdateValidHistory(i->valid_history, HISTORY_YEAR, TimerGameEconomy::month); UpdateValidHistory(i->valid_history, HISTORY_YEAR, TimerGameEconomy::month);