OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
13 #include "../safeguards.h"
21 for (NodeID node_id = 0; node_id < job.
Size(); ++node_id) {
22 Node &prev_node = job[node_id];
23 StationID prev = prev_node.base.
station;
24 for (
const Path *path : prev_node.paths) {
28 StationID via = node.base.
station;
29 StationID origin = job[path->
GetOrigin()].base.station;
30 assert(prev != via && via != origin);
32 node.flows.AddFlow(origin, via, flow);
36 prev_node.flows.PassOnFlow(origin, via, flow);
39 prev_node.flows.AddFlow(origin, via, flow);
44 for (NodeID node_id = 0; node_id < job.
Size(); ++node_id) {
46 Node &node = job[node_id];
54 for (
auto &it : flows) {
55 it.second.ScaleToMonthly(runtime.base());
59 for (
Path *i : node.paths)
delete i;
A leg of a path in the link graph.
const LinkGraphSettings & Settings() const
Get the link graph settings for this component.
Class for calculation jobs to be run on link graphs.
TimerGameEconomy::Date LastCompression() const
Get the date when the underlying link graph was last compressed.
StationID station
Station ID.
void FinalizeLocalConsumption(StationID self)
Subtract invalid flows from locally consumed flow.
NodeID Size() const
Get the size of the underlying link graph.
const bool scale
Whether the flow mapper should scale all flows to monthly values.
TimerGameEconomy::Date JoinDate() const
Get the date when the job should be finished.
Flow descriptions by origin stations.
static constexpr int SECONDS_PER_DAY
approximate seconds per day, not for precise calculations
uint16_t recalc_time
time (in days) for recalculating each link graph component.
NodeID GetOrigin() const
Get the overall origin of the path.
uint GetFlow() const
Get the flow on this leg.
NodeID GetNode() const
Get the node this leg passes.
void Run(LinkGraphJob &job) const override
Map the paths generated by the MCF solver into flows associated with nodes.