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

Function IsRoadStopAvailable

src/road_gui.cpp:102–113  ·  view source on GitHub ↗

* Check whether a road stop type can be built. * @return true if building is allowed. */

Source from the content-addressed store, hash-verified

100 * @return true if building is allowed.
101 */
102static bool IsRoadStopAvailable(const RoadStopSpec *spec, StationType type)
103{
104 if (spec == nullptr) return true;
105 if (!IsRoadStopEverAvailable(spec, type)) return false;
106
107 if (!spec->callback_mask.Test(RoadStopCallbackMask::Avail)) return true;
108
109 uint16_t cb_res = GetRoadStopCallback(CBID_STATION_AVAILABILITY, 0, 0, spec, nullptr, INVALID_TILE, _cur_roadtype, type, 0);
110 if (cb_res == CALLBACK_FAILED) return true;
111
112 return Convert8bitBooleanCallback(spec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res);
113}
114
115void CcPlaySound_CONSTRUCTION_OTHER(Commands, const CommandCost &result, TileIndex tile)
116{

Callers 2

IsTypeAvailableMethod · 0.85
IsTypeAvailableMethod · 0.85

Calls 4

IsRoadStopEverAvailableFunction · 0.85
GetRoadStopCallbackFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected