1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-12 16:02:07 +01:00

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 GitHub
parent 6fc4bef0e3
commit 2212169a8c

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);