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

Method Fork

src/linkgraph/linkgraphjob.cpp:199–211  ·  view source on GitHub ↗

* Add this path as a new child to the given base path, thus making this path * a "fork" of the base path. * @param base Path to fork from. * @param cap Maximum capacity of the new leg. * @param free_cap Remaining free capacity of the new leg. * @param dist Distance of the new leg. */

Source from the content-addressed store, hash-verified

197 * @param dist Distance of the new leg.
198 */
199void Path::Fork(Path *base, uint cap, int free_cap, uint dist)
200{
201 this->capacity = std::min(base->capacity, cap);
202 this->free_capacity = std::min(base->free_capacity, free_cap);
203 this->distance = base->distance + dist;
204 assert(this->distance > 0);
205 if (this->parent != base) {
206 this->Detach();
207 this->parent = base;
208 this->parent->num_children++;
209 }
210 this->origin = base->origin;
211}
212
213/**
214 * Push some flow along a path and register the path in the nodes it passes if

Callers 1

DijkstraMethod · 0.80

Calls 1

DetachMethod · 0.95

Tested by

no test coverage detected