Slightly speed up unordered iteration of FlowStatMap

This commit is contained in:
Jonathan G Rennison
2024-01-16 23:15:56 +00:00
parent 4458d3b61c
commit 81c2c4a881
3 changed files with 9 additions and 3 deletions

View File

@@ -5629,7 +5629,7 @@ void FlowStatMap::RestrictFlows(StationID via)
uint FlowStatMap::GetFlow() const
{
uint ret = 0;
for (const FlowStat &it : *this) {
for (const FlowStat &it : this->IterateUnordered()) {
if (it.IsInvalid()) continue;
ret += (it.end() - 1)->first;
}
@@ -5644,7 +5644,7 @@ uint FlowStatMap::GetFlow() const
uint FlowStatMap::GetFlowVia(StationID via) const
{
uint ret = 0;
for (const FlowStat &it : *this) {
for (const FlowStat &it : this->IterateUnordered()) {
if (it.IsInvalid()) continue;
ret += it.GetShare(via);
}