Fix #14396: Industry production graph showed zero instead of N/A.

Record the number of valid history records per industry so that the graph avoids showing values which are not present as zero.
This commit is contained in:
Peter Nelson
2025-07-06 15:33:22 +01:00
committed by Peter Nelson
parent 9b55ad5b8d
commit 290144c5c9
7 changed files with 49 additions and 4 deletions

View File

@@ -1837,6 +1837,8 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
for (auto &p : i->produced) {
p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false);
}
UpdateValidHistory(i->valid_history);
}
if (indspec->callback_mask.Test(IndustryCallbackMask::DecideColour)) {
@@ -2494,6 +2496,8 @@ void GenerateIndustries()
*/
static void UpdateIndustryStatistics(Industry *i)
{
UpdateValidHistory(i->valid_history);
for (auto &p : i->produced) {
if (IsValidCargoType(p.cargo)) {
if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year;