diff options
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index be308c410..012475d21 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1353,9 +1353,25 @@ struct VehicleDetailsWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case VLD_WIDGET_TOP_DETAILS: + case VLD_WIDGET_TOP_DETAILS: { + Dimension dim = { 0, 0 }; size->height = WD_FRAMERECT_TOP + 4 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM; - break; + + for (uint i = 0; i < 4; i++) SetDParam(i, INT16_MAX); + static const StringID info_strings[] = { + STR_VEHICLE_INFO_MAX_SPEED, + STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, + STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE, + STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR, + STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS + }; + for (uint i = 0; i < lengthof(info_strings); i++) { + dim = maxdim(dim, GetStringBoundingBox(info_strings[i])); + } + SetDParam(0, STR_VEHICLE_INFO_AGE); + dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_AGE_RUNNING_COST_YR)); + size->width = dim.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + } break; case VLD_WIDGET_MIDDLE_DETAILS: { const Vehicle *v = Vehicle::Get(this->window_number); |