1
0
Fork 0

Add: Show all railtypes in the build vehicle and engine preview dialogs.

pull/14357/head
Michael Lutz 2025-06-13 23:00:51 +02:00
parent d59095aa5e
commit 1fec42024c
3 changed files with 25 additions and 0 deletions

View File

@ -632,6 +632,17 @@ 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 (RailType rt : rvi->railtypes) {
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);

View File

@ -182,6 +182,18 @@ 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 (RailType rt : e.u.rail.railtypes) {
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;

View File

@ -4170,6 +4170,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
@ -4353,6 +4354,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}