Codechange: Generic type and container for history statistics.

This commit is contained in:
Peter Nelson
2025-06-24 19:59:41 +01:00
committed by Peter Nelson
parent f6e78a480d
commit 9b55ad5b8d
6 changed files with 87 additions and 16 deletions

View File

@@ -8,6 +8,8 @@
/** @file industry_cmd.cpp Handling of industry tiles. */
#include "stdafx.h"
#include "misc/history_type.hpp"
#include "misc/history_func.hpp"
#include "clear_map.h"
#include "industry.h"
#include "station_base.h"
@@ -2496,10 +2498,7 @@ static void UpdateIndustryStatistics(Industry *i)
if (IsValidCargoType(p.cargo)) {
if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year;
/* Move history from this month to last month. */
std::rotate(std::rbegin(p.history), std::rbegin(p.history) + 1, std::rend(p.history));
p.history[THIS_MONTH].production = 0;
p.history[THIS_MONTH].transported = 0;
RotateHistory(p.history);
}
}
}