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

Function GetRoadTypes

src/road.cpp:238–257  ·  view source on GitHub ↗

* Get list of road types, regardless of company availability. * @param introduces If true, include road types introduced by other road types * @return the road types. */

Source from the content-addressed store, hash-verified

236 * @return the road types.
237 */
238RoadTypes GetRoadTypes(bool introduces)
239{
240 RoadTypes rts{};
241
242 for (const Engine *e : Engine::IterateType(VEH_ROAD)) {
243 const EngineInfo *ei = &e->info;
244 if (!ei->climates.Test(_settings_game.game_creation.landscape)) continue;
245
246 const RoadVehicleInfo *rvi = &e->VehInfo<RoadVehicleInfo>();
247 assert(rvi->roadtype < ROADTYPE_END);
248 if (introduces) {
249 rts.Set(GetRoadTypeInfo(rvi->roadtype)->introduces_roadtypes);
250 } else {
251 rts.Set(rvi->roadtype);
252 }
253 }
254
255 if (introduces) return AddDateIntroducedRoadTypes(rts, CalendarTime::MAX_DATE);
256 return rts;
257}
258
259/**
260 * Get the road type for a given label.

Callers 4

OnPaintMethod · 0.85
GetRoadTypeDropDownListFunction · 0.85

Calls 4

GetRoadTypeInfoFunction · 0.85
TestMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected