Center company icon on league table.
This commit is contained in:
@@ -1128,6 +1128,7 @@ private:
|
||||
uint ordinal_width; ///< The width of the ordinal number
|
||||
uint text_width; ///< The width of the actual text
|
||||
uint icon_width; ///< The width of the company icon
|
||||
uint icon_y_offset; ///< The vertical offset for drawing the company icon.
|
||||
int line_height; ///< Height of the text lines
|
||||
|
||||
/**
|
||||
@@ -1174,8 +1175,7 @@ public:
|
||||
{
|
||||
if (widget != WID_CL_BACKGROUND) return;
|
||||
|
||||
int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - this->line_height) / 2;
|
||||
uint y = r.top + WD_FRAMERECT_TOP - icon_y_offset;
|
||||
uint y = r.top + WD_FRAMERECT_TOP;
|
||||
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
uint ordinal_left = rtl ? r.right - WD_FRAMERECT_LEFT - this->ordinal_width : r.left + WD_FRAMERECT_LEFT;
|
||||
@@ -1188,7 +1188,7 @@ public:
|
||||
const Company *c = this->companies[i];
|
||||
DrawString(ordinal_left, ordinal_right, y, i + STR_ORDINAL_NUMBER_1ST, i == 0 ? TC_WHITE : TC_YELLOW);
|
||||
|
||||
DrawCompanyIcon(c->index, icon_left, y + icon_y_offset);
|
||||
DrawCompanyIcon(c->index, icon_left, y + this->icon_y_offset);
|
||||
|
||||
SetDParam(0, c->index);
|
||||
SetDParam(1, c->index);
|
||||
@@ -1221,6 +1221,7 @@ public:
|
||||
Dimension d = GetSpriteSize(SPR_COMPANY_ICON);
|
||||
this->icon_width = d.width + 2;
|
||||
this->line_height = max<int>(d.height + 2, FONT_HEIGHT_NORMAL);
|
||||
this->icon_y_offset = Center(1, this->line_height, d.height);
|
||||
|
||||
const Company *c;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
|
||||
Reference in New Issue
Block a user