diff options
Diffstat (limited to 'src/linkgraph/linkgraph.h')
-rw-r--r-- | src/linkgraph/linkgraph.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index a11b67a52..3a2c37977 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -62,6 +62,7 @@ public: struct BaseEdge { uint capacity; ///< Capacity of the link. uint usage; ///< Usage of the link. + uint64 travel_time_sum; ///< Sum of the travel times of the link, in ticks. Date last_unrestricted_update; ///< When the unrestricted part of the link was last updated. Date last_restricted_update; ///< When the restricted part of the link was last updated. NodeID next_edge; ///< Destination of next valid edge starting at the same source node. @@ -98,6 +99,12 @@ public: uint Usage() const { return this->edge.usage; } /** + * Get edge's average travel time. + * @return Travel time, in ticks. + */ + uint32 TravelTime() const { return this->edge.travel_time_sum / this->edge.capacity; } + + /** * Get the date of the last update to the edge's unrestricted capacity. * @return Last update. */ @@ -296,7 +303,7 @@ public: * @param edge Edge to be wrapped. */ Edge(BaseEdge &edge) : EdgeWrapper<BaseEdge>(edge) {} - void Update(uint capacity, uint usage, EdgeUpdateMode mode); + void Update(uint capacity, uint usage, uint32 time, EdgeUpdateMode mode); void Restrict() { this->edge.last_unrestricted_update = INVALID_DATE; } void Release() { this->edge.last_restricted_update = INVALID_DATE; } }; @@ -429,8 +436,8 @@ public: this->node.demand = demand; } - void AddEdge(NodeID to, uint capacity, uint usage, EdgeUpdateMode mode); - void UpdateEdge(NodeID to, uint capacity, uint usage, EdgeUpdateMode mode); + void AddEdge(NodeID to, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode); + void UpdateEdge(NodeID to, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode); void RemoveEdge(NodeID to); }; |