Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.
This commit is contained in:
@@ -3719,12 +3719,10 @@ void DeleteStaleLinks(Station *from)
|
||||
GoodsEntry &ge = from->goods[c];
|
||||
LinkGraph *lg = LinkGraph::GetIfValid(ge.link_graph);
|
||||
if (lg == nullptr) continue;
|
||||
Node node = (*lg)[ge.node];
|
||||
std::vector<NodeID> to_remove{};
|
||||
for (EdgeIterator it(node.Begin()); it != node.End(); ++it) {
|
||||
Edge edge = it->second;
|
||||
Station *to = Station::Get((*lg)[it->first].Station());
|
||||
assert(to->goods[c].node == it->first);
|
||||
for (Edge &edge : (*lg)[ge.node].edges) {
|
||||
Station *to = Station::Get((*lg)[edge.dest_node].station);
|
||||
assert(to->goods[c].node == edge.dest_node);
|
||||
assert(_date >= edge.LastUpdate());
|
||||
uint timeout = LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3);
|
||||
if ((uint)(_date - edge.LastUpdate()) > timeout) {
|
||||
@@ -3782,16 +3780,16 @@ void DeleteStaleLinks(Station *from)
|
||||
ge.flows.DeleteFlows(to->index);
|
||||
RerouteCargo(from, c, to->index, from->index);
|
||||
}
|
||||
} else if (edge.LastUnrestrictedUpdate() != INVALID_DATE && (uint)(_date - edge.LastUnrestrictedUpdate()) > timeout) {
|
||||
} else if (edge.last_unrestricted_update != INVALID_DATE && (uint)(_date - edge.last_unrestricted_update) > timeout) {
|
||||
edge.Restrict();
|
||||
ge.flows.RestrictFlows(to->index);
|
||||
RerouteCargo(from, c, to->index, from->index);
|
||||
} else if (edge.LastRestrictedUpdate() != INVALID_DATE && (uint)(_date - edge.LastRestrictedUpdate()) > timeout) {
|
||||
} else if (edge.last_restricted_update != INVALID_DATE && (uint)(_date - edge.last_restricted_update) > timeout) {
|
||||
edge.Release();
|
||||
}
|
||||
}
|
||||
/* Remove dead edges. */
|
||||
for (NodeID r : to_remove) node.RemoveEdge(r);
|
||||
for (NodeID r : to_remove) (*lg)[ge.node].RemoveEdge(r);
|
||||
|
||||
assert(_date >= lg->LastCompression());
|
||||
if ((uint)(_date - lg->LastCompression()) > LinkGraph::COMPRESSION_INTERVAL) {
|
||||
|
Reference in New Issue
Block a user