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

Function IsRoadStopEverAvailable

src/road_gui.cpp:83–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81static RoadStopPickerSelection _roadstop_gui;
82
83static bool IsRoadStopEverAvailable(const RoadStopSpec *spec, StationType type)
84{
85 if (spec == nullptr) return true;
86
87 if (spec->flags.Test(RoadStopSpecFlag::RoadOnly) && !RoadTypeIsRoad(_cur_roadtype)) return false;
88 if (spec->flags.Test(RoadStopSpecFlag::TramOnly) && !RoadTypeIsTram(_cur_roadtype)) return false;
89
90 switch (spec->stop_type) {
91 case ROADSTOPTYPE_ALL: return true;
92 case ROADSTOPTYPE_PASSENGER: return type == StationType::Bus;
93 case ROADSTOPTYPE_FREIGHT: return type == StationType::Truck;
94 default: NOT_REACHED();
95 }
96}
97
98/**
99 * Check whether a road stop type can be built.

Callers 3

IsRoadStopAvailableFunction · 0.85
GetTypeNameMethod · 0.85
GetTypeBadgesMethod · 0.85

Calls 4

RoadTypeIsRoadFunction · 0.85
RoadTypeIsTramFunction · 0.85
NOT_REACHEDFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected