Fix tooltip width on empty station

This commit is contained in:
dP
2020-05-19 19:44:08 +03:00
parent 7b15d2a938
commit 9fc36d5db0
3 changed files with 6 additions and 3 deletions

View File

@@ -5438,7 +5438,7 @@ STR_TOWN_CB_CARGO_FROM_NOT :{SILVER}{COMMA}
STR_CONFIG_SETTING_POLYRAIL_DOUBLECLICK_TOOLTIPS :Enable finishing polyrail with mouse double click{STRING2}
#tooltips extra
STR_CONFIG_SETTING_ENABLE_EXTRA_TOOLTIPS :Enable extra tooltips{STRING2}
STR_CONFIG_SETTING_ENABLE_EXTRA_TOOLTIPS :Enable extra tooltips: {STRING2}
STR_TTE_HOUSE_NAME :{LTBLUE}{STRING}
STR_TTE_HOUSE :{BLACK}Population: {NUM}
STR_TTE_INDUSTRY_NAME :{LTBLUE}{INDUSTRY}

View File

@@ -129,7 +129,7 @@ public:
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
uint width = GetStringBoundingBox(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
size->width = max(size->width, min(300u, width));
size->width = max(size->width, min<uint>(ScaleGUITrad(300), width));
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
size->height += GetStringHeight(STR_JUST_RAW_STRING, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT);
}
@@ -1440,6 +1440,9 @@ struct TooltipsExtraWindow : public Window
const Station *st = Station::GetIfValid((StationID)this->objIndex);
if(st == NULL) break;
SetDParam(0, st->index);
size->width = max(GetStringBoundingBox(STR_TTE_STATION_NAME).width, size->width);
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
const CargoSpec *cs = _sorted_cargo_specs[i];
if(cs == NULL) continue;

View File

@@ -83,4 +83,4 @@ const byte _openttd_revision_tagged = 1;
const uint32 _openttd_newgrf_version = 1 << 28 | 10 << 24 | 0 << 20 | 1 << 19 | 28004;
const char _citymania_version[] = "20200519-master-m25fce2d061 19.05.20";
const char _citymania_version[] = "20200519-master-m7b15d2a938 19.05.20";