forked from mirror/OpenTTD
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
This commit is contained in:
@@ -431,7 +431,7 @@ public:
|
||||
Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
|
||||
|
||||
if (free_space.has_value()) SetDParam(0, free_space.value());
|
||||
DrawString(ir.left, ir.right, ir.top + FONT_HEIGHT_NORMAL, free_space.has_value() ? STR_SAVELOAD_BYTES_FREE : STR_ERROR_UNABLE_TO_READ_DRIVE);
|
||||
DrawString(ir.left, ir.right, ir.top + GetCharacterHeight(FS_NORMAL), free_space.has_value() ? STR_SAVELOAD_BYTES_FREE : STR_ERROR_UNABLE_TO_READ_DRIVE);
|
||||
DrawString(ir.left, ir.right, ir.top, path, TC_BLACK);
|
||||
break;
|
||||
}
|
||||
@@ -465,7 +465,7 @@ public:
|
||||
void DrawDetails(const Rect &r) const
|
||||
{
|
||||
/* Header panel */
|
||||
int HEADER_HEIGHT = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.Vertical();
|
||||
int HEADER_HEIGHT = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.Vertical();
|
||||
|
||||
Rect hr = r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.frametext);
|
||||
Rect tr = r.Shrink(WidgetDimensions::scaled.frametext);
|
||||
@@ -478,13 +478,13 @@ public:
|
||||
if (this->selected == nullptr) return;
|
||||
|
||||
/* Details panel */
|
||||
tr.bottom -= FONT_HEIGHT_NORMAL - 1;
|
||||
tr.bottom -= GetCharacterHeight(FS_NORMAL) - 1;
|
||||
if (tr.top > tr.bottom) return;
|
||||
|
||||
if (!_load_check_data.checkable) {
|
||||
/* Old savegame, no information available */
|
||||
DrawString(tr, STR_SAVELOAD_DETAIL_NOT_AVAILABLE);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
} else if (_load_check_data.error != INVALID_STRING_ID) {
|
||||
/* Incompatible / broken savegame */
|
||||
SetDParamStr(0, _load_check_data.error_msg);
|
||||
@@ -494,7 +494,7 @@ public:
|
||||
SetDParam(0, _load_check_data.map_size_x);
|
||||
SetDParam(1, _load_check_data.map_size_y);
|
||||
DrawString(tr, STR_NETWORK_SERVER_LIST_MAP_SIZE);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
if (tr.top > tr.bottom) return;
|
||||
|
||||
/* Climate */
|
||||
@@ -502,7 +502,7 @@ public:
|
||||
if (landscape < NUM_LANDSCAPE) {
|
||||
SetDParam(0, STR_CLIMATE_TEMPERATE_LANDSCAPE + landscape);
|
||||
DrawString(tr, STR_NETWORK_SERVER_LIST_LANDSCAPE);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
}
|
||||
|
||||
tr.top += WidgetDimensions::scaled.vsep_normal;
|
||||
@@ -512,7 +512,7 @@ public:
|
||||
if (_load_check_data.settings.game_creation.starting_year != 0) {
|
||||
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(_load_check_data.settings.game_creation.starting_year, 0, 1));
|
||||
DrawString(tr, STR_NETWORK_SERVER_LIST_START_DATE);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
}
|
||||
if (tr.top > tr.bottom) return;
|
||||
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
/* Current date */
|
||||
SetDParam(0, _load_check_data.current_date);
|
||||
DrawString(tr, STR_NETWORK_SERVER_LIST_CURRENT_DATE);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
}
|
||||
|
||||
/* Hide the NewGRF stuff when saving. We also hide the button. */
|
||||
@@ -533,7 +533,7 @@ public:
|
||||
SetDParam(0, _load_check_data.grfconfig == nullptr ? STR_NEWGRF_LIST_NONE :
|
||||
STR_NEWGRF_LIST_ALL_FOUND + _load_check_data.grf_compatibility);
|
||||
DrawString(tr, STR_SAVELOAD_DETAIL_GRFSTATUS);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
}
|
||||
if (tr.top > tr.bottom) return;
|
||||
|
||||
@@ -554,7 +554,7 @@ public:
|
||||
SetDParam(2, c.name_2);
|
||||
}
|
||||
DrawString(tr, STR_SAVELOAD_DETAIL_COMPANY_INDEX);
|
||||
tr.top += FONT_HEIGHT_NORMAL;
|
||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||
if (tr.top > tr.bottom) break;
|
||||
}
|
||||
}
|
||||
@@ -565,11 +565,11 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_SL_BACKGROUND:
|
||||
size->height = 2 * FONT_HEIGHT_NORMAL + padding.height;
|
||||
size->height = 2 * GetCharacterHeight(FS_NORMAL) + padding.height;
|
||||
break;
|
||||
|
||||
case WID_SL_DRIVES_DIRECTORIES_LIST:
|
||||
resize->height = FONT_HEIGHT_NORMAL;
|
||||
resize->height = GetCharacterHeight(FS_NORMAL);
|
||||
size->height = resize->height * 10 + padding.height;
|
||||
break;
|
||||
case WID_SL_SORT_BYNAME:
|
||||
|
Reference in New Issue
Block a user