Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.

This commit is contained in:
Michael Lutz
2023-01-03 13:48:42 +01:00
parent 4d3da0cf14
commit aab580e0ac
9 changed files with 94 additions and 409 deletions

View File

@@ -88,10 +88,10 @@ void LinkGraphOverlay::RebuildCache()
if (!LinkGraph::IsValidID(sta->goods[c].link_graph)) continue;
const LinkGraph &lg = *LinkGraph::Get(sta->goods[c].link_graph);
ConstNode from_node = lg[sta->goods[c].node];
supply += lg.Monthly(from_node.Supply());
for (ConstEdgeIterator i = from_node.Begin(); i != from_node.End(); ++i) {
StationID to = lg[i->first].Station();
ConstNode &from_node = lg[sta->goods[c].node];
supply += lg.Monthly(from_node.supply);
for (const Edge &edge : from_node.edges) {
StationID to = lg[edge.dest_node].station;
assert(from != to);
if (!Station::IsValidID(to) || seen_links.find(to) != seen_links.end()) {
continue;
@@ -218,8 +218,8 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
}
const LinkGraph &lg = *LinkGraph::Get(ge.link_graph);
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()),
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,
from->owner == OWNER_NONE || to->owner == OWNER_NONE,