Codechange: [Linkgraph] Only store present link graph edges and not all possible edges.

This commit is contained in:
Michael Lutz
2023-01-02 21:46:49 +01:00
parent 178249e7cc
commit 7352f812e6
9 changed files with 153 additions and 146 deletions

View File

@@ -217,8 +217,8 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
continue;
}
const LinkGraph &lg = *LinkGraph::Get(ge.link_graph);
ConstEdge edge = lg[ge.node][to->goods[c].node];
if (edge.Capacity() > 0) {
if (lg[ge.node].HasEdgeTo(to->goods[c].node)) {
ConstEdge edge = lg[ge.node][to->goods[c].node];
this->AddStats(c, lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()),
ge.flows.GetFlowVia(to->index),
edge.TravelTime() / DAY_TICKS,