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

Function removeRoadModsToTrackNetwork

src/OpenLoco/src/Vehicles/Routing.cpp:1666–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1664 }
1665
1666 currency32_t removeRoadModsToTrackNetwork(const World::Pos3& pos, Vehicles::TrackAndDirection::_RoadAndDirection roadAndDirection, CompanyId company, uint8_t roadType, uint8_t flags, World::Track::ModSection modSelection, uint8_t roadModObjIds)
1667 {
1668 currency32_t cost = 0;
1669 if (modSelection == Track::ModSection::single)
1670 {
1671 LocationOfInterest interest{ pos, roadAndDirection._data, company, roadType };
1672 removeRoadModToTrack(interest, flags, nullptr, modSelection, roadType, roadModObjIds, cost, company);
1673 return cost;
1674 }
1675
1676 RoutingResults routingResults{ kTrackModHashSetSize };
1677
1678 auto filterFunction = [flags, modSelection, roadType, roadModObjIds, &cost, company, &routingResults](const LocationOfInterest& interest) {
1679 return removeRoadModToTrack(interest, flags, &routingResults, modSelection, roadType, roadModObjIds, cost, company);
1680 };
1681 findAllRoadsFilterTransform(routingResults, TrackNetworkSearchFlags::none, pos, roadAndDirection, company, roadType, filterFunction, kNullTransformFunction);
1682 return cost;
1683 }
1684}

Callers 1

removeRoadModFunction · 0.85

Calls 2

removeRoadModToTrackFunction · 0.85

Tested by

no test coverage detected