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

Method Run

src/linkgraph/refresh.cpp:26–39  ·  view source on GitHub ↗

* Refresh all links the given vehicle will visit. * @param v Vehicle to refresh links for. * @param allow_merge If the refresher is allowed to merge or extend link graphs. * @param is_full_loading If the vehicle is full loading. */ static */

Source from the content-addressed store, hash-verified

24 * @param is_full_loading If the vehicle is full loading.
25 */
26/* static */ void LinkRefresher::Run(Vehicle *v, bool allow_merge, bool is_full_loading)
27{
28 /* If there are no orders we can't predict anything.*/
29 if (v->orders == nullptr) return;
30
31 /* Make sure the first order is a useful order. */
32 VehicleOrderID first = v->orders->GetNextDecisionNode(v->cur_implicit_order_index, 0);
33 if (first == INVALID_VEH_ORDER_ID) return;
34
35 HopSet seen_hops;
36 LinkRefresher refresher(v, &seen_hops, allow_merge, is_full_loading);
37
38 refresher.RefreshLinks(first, first, v->last_loading_station != StationID::Invalid() ? RefreshFlags{RefreshFlag::HasCargo} : RefreshFlags{});
39}
40
41/**
42 * Constructor for link refreshing algorithm.

Callers

nothing calls this directly

Calls 3

InvalidFunction · 0.85
GetNextDecisionNodeMethod · 0.80
RefreshLinksMethod · 0.80

Tested by

no test coverage detected