* 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. */
| 236 | * @return the road types. |
| 237 | */ |
| 238 | RoadTypes 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. |
no test coverage detected