|
OpenTTD Source 20261112-master-gbcbec5e63f
|
An edge in the link graph. More...
#include <linkgraph.h>
Public Member Functions | |
| BaseEdge (NodeID dest_node=INVALID_NODE) | |
| Create an edge. | |
| uint32_t | TravelTime () const |
| Get edge's average travel time. | |
| TimerGameEconomy::Date | LastUpdate () const |
| Get the date of the last update to any part of the edge's capacity. | |
| void | Update (uint capacity, uint usage, uint32_t time, EdgeUpdateModes modes) |
| Update an edge. | |
| void | Restrict () |
| void | Release () |
| auto | operator<=> (const BaseEdge &rhs) const noexcept |
Comparison operator based on dest_node. | |
| auto | operator<=> (NodeID rhs) const noexcept |
| Compare with a NodeID. | |
Data Fields | |
| uint | capacity = 0 |
| Capacity of the link. | |
| uint | usage = 0 |
| Usage of the link. | |
| uint64_t | travel_time_sum = 0 |
| Sum of the travel times of the link, in ticks. | |
| TimerGameEconomy::Date | last_unrestricted_update {} |
| When the unrestricted part of the link was last updated. | |
| TimerGameEconomy::Date | last_restricted_update {} |
| When the restricted part of the link was last updated. | |
| NodeID | dest_node = INVALID_NODE |
| Destination of the edge. | |
Friends | |
| auto | operator<=> (NodeID lhs, const LinkGraph::BaseEdge &rhs) noexcept |
| Compare a NodeID with a BaseEdge. | |
An edge in the link graph.
Corresponds to a link between two stations.
Definition at line 40 of file linkgraph.h.
| LinkGraph::BaseEdge::BaseEdge | ( | NodeID | dest_node = INVALID_NODE | ) |
Create an edge.
| dest_node | The destination of this edge. |
Definition at line 39 of file linkgraph.cpp.
References capacity, dest_node, TimerGameConst< struct Economy >::INVALID_DATE, last_restricted_update, last_unrestricted_update, travel_time_sum, and usage.
Referenced by operator<=>().
|
inline |
Get the date of the last update to any part of the edge's capacity.
Definition at line 60 of file linkgraph.h.
|
inlinenoexcept |
Comparison operator based on dest_node.
| rhs | The right hand side of the comparison. |
true iff our dest_node is smaller than the other's. Definition at line 71 of file linkgraph.h.
References BaseEdge(), and dest_node.
|
inlinenoexcept |
Compare with a NodeID.
| rhs | The right hand side of the comparison. |
Definition at line 81 of file linkgraph.h.
References dest_node.
|
inline |
Definition at line 64 of file linkgraph.h.
|
inline |
Definition at line 63 of file linkgraph.h.
|
inline |
Get edge's average travel time.
Definition at line 54 of file linkgraph.h.
Referenced by LinkGraphOverlay::AddLinks(), and MultiCommodityFlow::Dijkstra().
| void LinkGraph::BaseEdge::Update | ( | uint | capacity, |
| uint | usage, | ||
| uint32_t | travel_time, | ||
| EdgeUpdateModes | modes ) |
Update an edge.
If mode contains UM_REFRESH refresh the edge to have at least the given capacity and usage, otherwise add the capacity, usage and travel time. In any case set the respective update timestamp(s), according to the given mode.
| capacity | Capacity to be added/updated. |
| usage | Usage to be added. |
| travel_time | Travel time to be added, in ticks. |
| modes | Update modes to be applied. |
Definition at line 220 of file linkgraph.cpp.
References capacity, TimerGameEconomy::date, Increase, last_restricted_update, last_unrestricted_update, Refresh, Restricted, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), travel_time_sum, Unrestricted, and usage.
|
friend |
Compare a NodeID with a BaseEdge.
| lhs | The left hand side of the comparison. |
| rhs | The right hand side of the comparison. |
Definition at line 92 of file linkgraph.h.
| uint LinkGraph::BaseEdge::capacity = 0 |
Capacity of the link.
Definition at line 41 of file linkgraph.h.
Referenced by LinkGraph::BaseNode::AddEdge(), Path::AddFlow(), LinkGraphOverlay::AddLinks(), BaseEdge(), MultiCommodityFlow::Dijkstra(), LinkGraph::Merge(), and Update().
| NodeID LinkGraph::BaseEdge::dest_node = INVALID_NODE |
Destination of the edge.
Definition at line 46 of file linkgraph.h.
Referenced by BaseEdge(), operator<=>(), operator<=>(), LinkGraphJob::NodeAnnotation::operator[](), LinkGraphJob::NodeAnnotation::operator[](), and LinkGraphOverlay::RebuildCache().
| TimerGameEconomy::Date LinkGraph::BaseEdge::last_restricted_update {} |
When the restricted part of the link was last updated.
Definition at line 45 of file linkgraph.h.
Referenced by LinkGraph::BaseNode::AddEdge(), BaseEdge(), and Update().
| TimerGameEconomy::Date LinkGraph::BaseEdge::last_unrestricted_update {} |
When the unrestricted part of the link was last updated.
Definition at line 44 of file linkgraph.h.
Referenced by LinkGraph::BaseNode::AddEdge(), BaseEdge(), and Update().
| uint64_t LinkGraph::BaseEdge::travel_time_sum = 0 |
Sum of the travel times of the link, in ticks.
Definition at line 43 of file linkgraph.h.
Referenced by LinkGraph::BaseNode::AddEdge(), BaseEdge(), LinkGraph::Merge(), and Update().
| uint LinkGraph::BaseEdge::usage = 0 |
Usage of the link.
Definition at line 42 of file linkgraph.h.
Referenced by LinkGraph::BaseNode::AddEdge(), LinkGraphOverlay::AddLinks(), BaseEdge(), LinkGraph::Merge(), and Update().