* Monthly update of industry statistics. * @param i Industry to update. */
| 2564 | * @param i Industry to update. |
| 2565 | */ |
| 2566 | static void UpdateIndustryStatistics(Industry *i) |
| 2567 | { |
| 2568 | auto month = TimerGameEconomy::month; |
| 2569 | UpdateValidHistory(i->valid_history, HISTORY_YEAR, month); |
| 2570 | |
| 2571 | for (auto &p : i->produced) { |
| 2572 | if (IsValidCargoType(p.cargo)) { |
| 2573 | if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year; |
| 2574 | |
| 2575 | RotateHistory(p.history, i->valid_history, HISTORY_YEAR, month); |
| 2576 | } |
| 2577 | } |
| 2578 | |
| 2579 | for (auto &a : i->accepted) { |
| 2580 | if (!IsValidCargoType(a.cargo)) continue; |
| 2581 | if (a.history == nullptr) continue; |
| 2582 | |
| 2583 | (*a.history)[THIS_MONTH].waiting = GetAndResetAccumulatedAverage<uint16_t>(a.accumulated_waiting); |
| 2584 | RotateHistory(*a.history, i->valid_history, HISTORY_YEAR, month); |
| 2585 | } |
| 2586 | } |
| 2587 | |
| 2588 | /** |
| 2589 | * Recompute #production_rate for current #prod_level. |
no test coverage detected