MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / findFreeRoutingVehicleRef

Function findFreeRoutingVehicleRef

src/OpenLoco/src/Vehicles/RoutingManager.cpp:9–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7 static auto& routings() { return getGameState().routings; }
8
9 static std::optional<uint16_t> findFreeRoutingVehicleRef()
10 {
11 const auto& routingArr = routings();
12 const auto res = std::find_if(std::begin(routingArr), std::end(routingArr), [](const auto& route) { return route[0] == kRoutingNull; });
13 if (res == std::end(routingArr))
14 {
15 return std::nullopt;
16 }
17 return std::distance(std::begin(routingArr), res);
18 }
19
20 void resetRoutings(const RoutingHandle handle)
21 {

Callers 2

Calls 2

beginFunction · 0.85
endFunction · 0.85

Tested by

no test coverage detected