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

@@ -222,6 +222,7 @@ protected:
const Tprojection &proj; ///< Projection to apply.
inline void Fill(uint i, const auto &data) const { this->dataset.values[i] = std::invoke(this->proj, data); }
inline void MakeInvalid(uint i) const { this->dataset.values[i] = INVALID_DATAPOINT; }
};
/**
@@ -1685,7 +1686,7 @@ struct IndustryProductionGraphWindow : BaseCargoGraphWindow {
transported.dash = 2;
auto transported_filler = Filler{transported, &Industry::ProducedHistory::transported};
FillFromHistory<GRAPH_NUM_MONTHS>(p.history, produced_filler, transported_filler);
FillFromHistory<GRAPH_NUM_MONTHS>(p.history, i->valid_history, produced_filler, transported_filler);
}
this->SetDirty();