1
0
Fork 0
Jonathan G Rennison 2025-07-19 23:49:25 +01:00 committed by GitHub
commit 551c99dee2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -42,13 +42,13 @@ LinkGraphJob::LinkGraphJob(const LinkGraph &orig) :
} }
/** /**
* Erase all flows originating at a specific node. * Erase all flows originating at a specific station.
* @param from Node to erase flows for. * @param from StationID to erase flows for.
*/ */
void LinkGraphJob::EraseFlows(NodeID from) void LinkGraphJob::EraseFlows(StationID from)
{ {
for (NodeID node_id = 0; node_id < this->Size(); ++node_id) { for (NodeID node_id = 0; node_id < this->Size(); ++node_id) {
(*this)[node_id].flows.erase(StationID{from}); (*this)[node_id].flows.erase(from);
} }
} }
@ -106,7 +106,7 @@ LinkGraphJob::~LinkGraphJob()
/* The station can have been deleted. Remove all flows originating from it then. */ /* The station can have been deleted. Remove all flows originating from it then. */
Station *st = Station::GetIfValid(from.base.station); Station *st = Station::GetIfValid(from.base.station);
if (st == nullptr) { if (st == nullptr) {
this->EraseFlows(node_id); this->EraseFlows(from.base.station);
continue; continue;
} }
@ -114,7 +114,7 @@ LinkGraphJob::~LinkGraphJob()
* sure that everything is still consistent or ignore it otherwise. */ * sure that everything is still consistent or ignore it otherwise. */
GoodsEntry &ge = st->goods[this->Cargo()]; GoodsEntry &ge = st->goods[this->Cargo()];
if (ge.link_graph != this->link_graph.index || ge.node != node_id) { if (ge.link_graph != this->link_graph.index || ge.node != node_id) {
this->EraseFlows(node_id); this->EraseFlows(from.base.station);
continue; continue;
} }

View File

@ -167,7 +167,7 @@ protected:
std::atomic<bool> job_completed = false; ///< Is the job still running. This is accessed by multiple threads and reads may be stale. std::atomic<bool> job_completed = false; ///< Is the job still running. This is accessed by multiple threads and reads may be stale.
std::atomic<bool> job_aborted = false; ///< Has the job been aborted. This is accessed by multiple threads and reads may be stale. std::atomic<bool> job_aborted = false; ///< Has the job been aborted. This is accessed by multiple threads and reads may be stale.
void EraseFlows(NodeID from); void EraseFlows(StationID from);
void JoinThread(); void JoinThread();
void SpawnThread(); void SpawnThread();