|
OpenTTD Source 20251104-master-g3befbdd52f
|
Node of the link graph. More...
#include <linkgraph.h>
Public Member Functions | |
| BaseNode (TileIndex xy=INVALID_TILE, StationID st=StationID::Invalid(), uint demand=0) | |
| Create a node or clear it. | |
| void | UpdateSupply (uint supply) |
| Update the node's supply and set last_update to the current date. | |
| void | UpdateLocation (TileIndex xy) |
| Update the node's location on the map. | |
| void | SetDemand (uint demand) |
| Set the node's demand. | |
| void | AddEdge (NodeID to, uint capacity, uint usage, uint32_t time, EdgeUpdateModes modes) |
| Fill an edge with values from a link. | |
| void | UpdateEdge (NodeID to, uint capacity, uint usage, uint32_t time, EdgeUpdateModes modes) |
| Creates an edge if none exists yet or updates an existing edge. | |
| void | RemoveEdge (NodeID to) |
| Remove an outgoing edge from this node. | |
| bool | HasEdgeTo (NodeID dest) const |
| Check if an edge to a destination is present. | |
| BaseEdge & | operator[] (NodeID to) |
| const BaseEdge & | operator[] (NodeID to) const |
Data Fields | |
| uint | supply = 0 |
| Supply at the station. | |
| uint | demand = 0 |
| Acceptance at the station. | |
| StationID | station = StationID::Invalid() |
| Station ID. | |
| TileIndex | xy = INVALID_TILE |
| Location of the station referred to by the node. | |
| TimerGameEconomy::Date | last_update {} |
| When the supply was last updated. | |
| std::vector< BaseEdge > | edges |
| Sorted list of outgoing edges from this node. | |
Private Member Functions | |
| std::vector< BaseEdge >::iterator | GetEdge (NodeID dest) |
| std::vector< BaseEdge >::const_iterator | GetEdge (NodeID dest) const |
Node of the link graph.
contains all relevant information from the associated station. It's copied so that the link graph job can work on its own data set in a separate thread.
Definition at line 90 of file linkgraph.h.
| LinkGraph::BaseNode::BaseNode | ( | TileIndex | xy = INVALID_TILE, |
| StationID | st = StationID::Invalid(), |
||
| uint | demand = 0 |
||
| ) |
Create a node or clear it.
| xy | Location of the associated station. |
| st | ID of the associated station. |
| demand | Demand for cargo at the station. |
Definition at line 26 of file linkgraph.cpp.
References TimerGameConst< struct Economy >::INVALID_DATE.
| void LinkGraph::BaseNode::AddEdge | ( | NodeID | to, |
| uint | capacity, | ||
| uint | usage, | ||
| uint32_t | travel_time, | ||
| EdgeUpdateModes | modes | ||
| ) |
Fill an edge with values from a link.
Set the restricted or unrestricted update timestamp according to the given update mode.
| to | Destination node of the link. |
| capacity | Capacity of the link. |
| usage | Usage to be added. |
| mode | Update mode to be used. |
Definition at line 167 of file linkgraph.cpp.
References LinkGraph::BaseEdge::capacity, TimerGameEconomy::date, LinkGraph::BaseEdge::last_restricted_update, LinkGraph::BaseEdge::last_unrestricted_update, Restricted, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), LinkGraph::BaseEdge::travel_time_sum, Unrestricted, and LinkGraph::BaseEdge::usage.
|
inlineprivate |
Definition at line 156 of file linkgraph.h.
|
inlineprivate |
Definition at line 161 of file linkgraph.h.
|
inline |
Check if an edge to a destination is present.
| dest | Wanted edge destination. |
Definition at line 138 of file linkgraph.h.
|
inline |
Definition at line 143 of file linkgraph.h.
|
inline |
Definition at line 149 of file linkgraph.h.
| void LinkGraph::BaseNode::RemoveEdge | ( | NodeID | to | ) |
Remove an outgoing edge from this node.
| to | ID of destination node. |
Definition at line 201 of file linkgraph.cpp.
|
inline |
Set the node's demand.
| demand | New demand for the node. |
Definition at line 124 of file linkgraph.h.
References demand.
| void LinkGraph::BaseNode::UpdateEdge | ( | NodeID | to, |
| uint | capacity, | ||
| uint | usage, | ||
| uint32_t | travel_time, | ||
| EdgeUpdateModes | modes | ||
| ) |
Creates an edge if none exists yet or updates an existing edge.
| to | Target node. |
| capacity | Capacity of the link. |
| usage | Usage to be added. |
| mode | Update mode to be used. |
Definition at line 186 of file linkgraph.cpp.
|
inline |
Update the node's location on the map.
| xy | New location. |
Definition at line 115 of file linkgraph.h.
References xy.
|
inline |
Update the node's supply and set last_update to the current date.
| supply | Supply to be added. |
Definition at line 105 of file linkgraph.h.
References TimerGameEconomy::date, last_update, and supply.
| uint LinkGraph::BaseNode::demand = 0 |
Acceptance at the station.
Definition at line 92 of file linkgraph.h.
Referenced by SymmetricScaler::HasDemandLeft(), AsymmetricScaler::HasDemandLeft(), and SetDemand().
| std::vector<BaseEdge> LinkGraph::BaseNode::edges |
Sorted list of outgoing edges from this node.
Definition at line 97 of file linkgraph.h.
Referenced by LinkGraphOverlay::RebuildCache().
| TimerGameEconomy::Date LinkGraph::BaseNode::last_update {} |
When the supply was last updated.
Definition at line 95 of file linkgraph.h.
Referenced by LinkGraph::ShiftDates(), and UpdateSupply().
| StationID LinkGraph::BaseNode::station = StationID::Invalid() |
Station ID.
Definition at line 93 of file linkgraph.h.
Referenced by FlowMapper::Run(), and LinkGraphJob::~LinkGraphJob().
| uint LinkGraph::BaseNode::supply = 0 |
Supply at the station.
Definition at line 91 of file linkgraph.h.
Referenced by SymmetricScaler::AddNode(), AsymmetricScaler::EffectiveSupply(), SymmetricScaler::EffectiveSupply(), SymmetricScaler::HasDemandLeft(), LinkGraphOverlay::RebuildCache(), and UpdateSupply().
| TileIndex LinkGraph::BaseNode::xy = INVALID_TILE |
Location of the station referred to by the node.
Definition at line 94 of file linkgraph.h.
Referenced by UpdateLocation().