mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-17 09:22:42 +01:00
Add: Industry accepted and waiting history graphs.
Records amount of cargo accepted, and a rolling average of the waiting amount. Average waiting samples the waiting amount once per day for each industry, spread out over an economy day.
This commit is contained in:
committed by
Peter Nelson
parent
5eeda026a4
commit
56942a15c7
@@ -1245,6 +1245,10 @@ void OnTick_Industry()
|
||||
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
ProduceIndustryGoods(i);
|
||||
|
||||
if ((TimerGameTick::counter + i->index) % Ticks::DAY_TICKS == 0) {
|
||||
for (auto &a : i->accepted) a.accumulated_waiting += a.waiting;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2505,6 +2509,14 @@ static void UpdateIndustryStatistics(Industry *i)
|
||||
RotateHistory(p.history);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &a : i->accepted) {
|
||||
if (!IsValidCargoType(a.cargo)) continue;
|
||||
if (a.history == nullptr) continue;
|
||||
|
||||
(*a.history)[THIS_MONTH].waiting = GetAndResetAccumulatedAverage<uint16_t>(a.accumulated_waiting);
|
||||
RotateHistory(*a.history);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user