Mercurial > hg > openttd
changeset 13919:51d669f31152 draft
(svn r18450) -Fix [FS#3363]: initial size of the vehicle detail windows would occasionally be too small (although it could be resized)
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 09 Dec 2009 22:25:12 +0000 |
parents | 37741d4f1a5f |
children | 1fdd8fb7e347 |
files | src/vehicle_gui.cpp |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1353,9 +1353,25 @@ 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);