Link graph: Explicitly flag invalidated flow stats instead of minimising their flows
Entirely exclude invalidated flow stats from link stats Delete invalidated flow stats if they stay invalid for 32 link graph jobs This is to prevent large numbers of invalidated flow stats from unduly influencing link statistics
This commit is contained in:
@@ -148,10 +148,11 @@ void LinkGraphJob::FinaliseJob()
|
||||
for (FlowStatMap::iterator it(ge.flows.begin()); it != ge.flows.end();) {
|
||||
FlowStatMap::iterator new_it = flows.find(it->GetOrigin());
|
||||
if (new_it == flows.end()) {
|
||||
bool should_erase = true;
|
||||
if (_settings_game.linkgraph.GetDistributionType(this->Cargo()) != DT_MANUAL) {
|
||||
it->Invalidate();
|
||||
++it;
|
||||
} else {
|
||||
should_erase = it->Invalidate();
|
||||
}
|
||||
if (should_erase) {
|
||||
FlowStat shares(INVALID_STATION, INVALID_STATION, 1);
|
||||
it->SwapShares(shares);
|
||||
it = ge.flows.erase(it);
|
||||
@@ -159,6 +160,8 @@ void LinkGraphJob::FinaliseJob()
|
||||
shares_it != shares.end(); ++shares_it) {
|
||||
RerouteCargo(st, this->Cargo(), shares_it->second, st->index);
|
||||
}
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
} else {
|
||||
it->SwapShares(*new_it);
|
||||
|
Reference in New Issue
Block a user