MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateEdge

Method UpdateEdge

src/linkgraph/linkgraph.cpp:186–195  ·  view source on GitHub ↗

* Creates an edge if none exists yet or updates an existing edge. * @param to Target node. * @param capacity Capacity of the link. * @param usage Usage to be added. * @param mode Update mode to be used. */

Source from the content-addressed store, hash-verified

184 * @param mode Update mode to be used.
185 */
186void LinkGraph::BaseNode::UpdateEdge(NodeID to, uint capacity, uint usage, uint32_t travel_time, EdgeUpdateModes modes)
187{
188 assert(capacity > 0);
189 assert(usage <= capacity);
190 if (!this->HasEdgeTo(to)) {
191 this->AddEdge(to, capacity, usage, travel_time, modes);
192 } else {
193 this->GetEdge(to)->Update(capacity, usage, travel_time, modes);
194 }
195}
196
197/**
198 * Remove an outgoing edge from this node.

Callers 1

IncreaseStatsFunction · 0.80

Calls 4

HasEdgeToMethod · 0.95
AddEdgeMethod · 0.95
GetEdgeMethod · 0.95
UpdateMethod · 0.45

Tested by

no test coverage detected