diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 93655d9f9e..a40ad4ef35 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -632,6 +632,19 @@ static int DrawRailEnginePurchaseInfo(int left, int right, int y, EngineID engin } y += GetCharacterHeight(FS_NORMAL); + /* Supported rail types */ + std::string railtypes{}; + std::string_view list_separator = GetListSeparator(); + + for (const auto &rt : _sorted_railtypes) { + if (!rvi->railtypes.Test(rt)) continue; + + if (!railtypes.empty()) railtypes += list_separator; + AppendStringInPlace(railtypes, GetRailTypeInfo(rt)->strings.name); + } + DrawString(left, right, y, GetString(STR_PURCHASE_INFO_RAILTYPES, railtypes)); + y += GetCharacterHeight(FS_NORMAL); + /* Max speed - Engine power */ DrawString(left, right, y, GetString(STR_PURCHASE_INFO_SPEED_POWER, PackVelocity(e->GetDisplayMaxSpeed(), e->type), e->GetPower())); y += GetCharacterHeight(FS_NORMAL); diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index c494da2ef7..210cf3bdf1 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -182,6 +182,20 @@ static std::string GetTrainEngineInfoString(const Engine &e) res << GetString(STR_ENGINE_PREVIEW_COST_WEIGHT, e.GetCost(), e.GetDisplayWeight()); res << '\n'; + if (e.u.rail.railtypes.Count() > 1) { + std::string railtypes{}; + std::string_view list_separator = GetListSeparator(); + + for (const auto &rt : _sorted_railtypes) { + if (!e.u.rail.railtypes.Test(rt)) continue; + + if (!railtypes.empty()) railtypes += list_separator; + AppendStringInPlace(railtypes, GetRailTypeInfo(rt)->strings.name); + } + res << GetString(STR_ENGINE_PREVIEW_RAILTYPES, railtypes); + res << '\n'; + } + bool is_maglev = true; for (RailType rt : e.u.rail.railtypes) { is_maglev &= GetRailTypeInfo(rt)->acceleration_type == VehicleAccelerationModel::Maglev; diff --git a/src/lang/english.txt b/src/lang/english.txt index dcd008c392..5c346825c8 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4183,6 +4183,7 @@ STR_PURCHASE_INFO_ALL_BUT :All but {CARGO_ STR_PURCHASE_INFO_MAX_TE :{BLACK}Max. Tractive Effort: {GOLD}{FORCE} STR_PURCHASE_INFO_AIRCRAFT_RANGE :{BLACK}Range: {GOLD}{COMMA} tiles STR_PURCHASE_INFO_AIRCRAFT_TYPE :{BLACK}Aircraft type: {GOLD}{STRING} +STR_PURCHASE_INFO_RAILTYPES :{BLACK}Rail types: {GOLD}{RAW_STRING} ###length 3 STR_CARGO_TYPE_FILTER_ALL :All cargo types @@ -4366,6 +4367,7 @@ STR_ENGINE_PREVIEW_RUNCOST_YEAR :Running Cost: { STR_ENGINE_PREVIEW_RUNCOST_PERIOD :Running Cost: {CURRENCY_LONG}/period STR_ENGINE_PREVIEW_CAPACITY :Capacity: {CARGO_LONG} STR_ENGINE_PREVIEW_CAPACITY_2 :Capacity: {CARGO_LONG}, {CARGO_LONG} +STR_ENGINE_PREVIEW_RAILTYPES :Rail types: {RAW_STRING} # Autoreplace window STR_REPLACE_VEHICLES_WHITE :{WHITE}Replace {STRING} - {STRING1}