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

@@ -124,11 +124,12 @@ LinkGraphJob::~LinkGraphJob()
FlowStatMap &flows = from.Flows();
for (EdgeIterator it(from.Begin()); it != from.End(); ++it) {
if (from[it->first].Flow() == 0) continue;
if (it->second.Flow() == 0) continue;
StationID to = (*this)[it->first].Station();
Station *st2 = Station::GetIfValid(to);
if (st2 == nullptr || st2->goods[this->Cargo()].link_graph != this->link_graph.index ||
st2->goods[this->Cargo()].node != it->first ||
!(*lg)[node_id].HasEdgeTo(it->first) ||
(*lg)[node_id][it->first].LastUpdate() == INVALID_DATE) {
/* Edge has been removed. Delete flows. */
StationIDStack erased = flows.DeleteFlows(to);