mirror of https://github.com/OpenTTD/OpenTTD
Merge 9bd12f4634
into a8650c6b06
commit
551c99dee2
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue