* Get list of rail types, regardless of company availability. * @param introduces If true, include rail types introduced by other rail types * @return the rail types. */
| 164 | * @return the rail types. |
| 165 | */ |
| 166 | RailTypes GetRailTypes(bool introduces) |
| 167 | { |
| 168 | RailTypes rts{}; |
| 169 | |
| 170 | for (const Engine *e : Engine::IterateType(VEH_TRAIN)) { |
| 171 | const EngineInfo *ei = &e->info; |
| 172 | if (!ei->climates.Test(_settings_game.game_creation.landscape)) continue; |
| 173 | |
| 174 | const RailVehicleInfo *rvi = &e->VehInfo<RailVehicleInfo>(); |
| 175 | if (rvi->railveh_type != RAILVEH_WAGON) { |
| 176 | assert(rvi->railtypes.Any()); |
| 177 | if (introduces) { |
| 178 | rts.Set(GetAllIntroducesRailTypes(rvi->railtypes)); |
| 179 | } else { |
| 180 | rts.Set(rvi->railtypes); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | if (introduces) return AddDateIntroducedRailTypes(rts, CalendarTime::MAX_DATE); |
| 186 | return rts; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Get the rail type for a given label. |
no test coverage detected