summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/network_gui.cpp20
-rw-r--r--src/statusbar_gui.cpp5
-rw-r--r--src/town_gui.cpp21
-rw-r--r--src/vehicle_gui.cpp2
4 files changed, 32 insertions, 16 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index f840b338f..1d57179c6 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1547,10 +1547,18 @@ struct NetworkLobbyWindow : public Window {
uint left = r.left + WD_FRAMERECT_LEFT;
uint right = r.right - WD_FRAMERECT_RIGHT;
- uint text_left = left + (rtl ? 20 : 0);
- uint text_right = right - (rtl ? 0 : 20);
- uint blob_left = rtl ? left : right - 10;
- uint lock_left = rtl ? left + 10 : right - 20;
+ Dimension lock_size = GetSpriteSize(SPR_LOCK);
+ int lock_width = lock_size.width;
+ int lock_y_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - lock_size.height) / 2;
+
+ Dimension profit_size = GetSpriteSize(SPR_BLOT);
+ int profit_width = lock_size.width;
+ int profit_y_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - profit_size.height) / 2;
+
+ uint text_left = left + (rtl ? lock_width + profit_width + 4 : 0);
+ uint text_right = right - (rtl ? 0 : lock_width + profit_width + 4);
+ uint profit_left = rtl ? left : right - profit_width;
+ uint lock_left = rtl ? left + profit_width + 2 : right - profit_width - lock_width - 2;
int y = r.top + WD_MATRIX_TOP;
/* Draw company list */
@@ -1563,11 +1571,11 @@ struct NetworkLobbyWindow : public Window {
}
DrawString(text_left, text_right, y, this->company_info[company].company_name, TC_BLACK);
- if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, lock_left, y);
+ if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, lock_left, y + lock_y_offset);
/* If the company's income was positive puts a green dot else a red dot */
if (this->company_info[company].income >= 0) income = true;
- DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, blob_left, y + (FONT_HEIGHT_NORMAL - 10) / 2);
+ DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, profit_left, y + profit_y_offset);
pos++;
y += this->resize.step_height;
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index a8b142498..7c4849faf 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -180,7 +180,10 @@ struct StatusBarWindow : Window {
}
}
- if (this->reminder_timeout > 0) DrawSprite(SPR_BLOT, PALETTE_TO_RED, r.right - WD_FRAMERECT_RIGHT - 10, r.top + WD_FRAMERECT_TOP + 1);
+ if (this->reminder_timeout > 0) {
+ Dimension icon_size = GetSpriteSize(SPR_BLOT);
+ DrawSprite(SPR_BLOT, PALETTE_TO_RED, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (FONT_HEIGHT_NORMAL - icon_size.height) / 2);
+ }
break;
}
}
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index badaca253..ff78ff3e3 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -135,20 +135,25 @@ public:
DrawString(left, right, y, STR_LOCAL_AUTHORITY_COMPANY_RATINGS);
y += FONT_HEIGHT_NORMAL;
- int sprite_y_offset = (FONT_HEIGHT_NORMAL - 10) / 2;
- uint icon_width = GetSpriteSize(SPR_COMPANY_ICON).width;
- uint exclusive_width = GetSpriteSize(SPR_BLOT).width;
+ Dimension icon_size = GetSpriteSize(SPR_COMPANY_ICON);
+ int icon_width = icon_size.width;
+ int icon_y_offset = (FONT_HEIGHT_NORMAL - icon_size.height) / 2;
+
+ Dimension exclusive_size = GetSpriteSize(SPR_BLOT);
+ int exclusive_width = exclusive_size.width;
+ int exlusive_y_offset = (FONT_HEIGHT_NORMAL - exclusive_size.height) / 2;
+
bool rtl = _dynlang.text_dir == TD_RTL;
- uint text_left = left + (rtl ? 0 : icon_width + exclusive_width + 4);
- uint text_right = right - (rtl ? icon_width + exclusive_width + 4 : 0);
- uint icon_left = rtl ? right - icon_width : left;
+ uint text_left = left + (rtl ? 0 : icon_width + exclusive_width + 4);
+ uint text_right = right - (rtl ? icon_width + exclusive_width + 4 : 0);
+ uint icon_left = rtl ? right - icon_width : left;
uint exclusive_left = rtl ? right - icon_width - exclusive_width - 2 : left + icon_width + 2;
/* Draw list of companies */
const Company *c;
FOR_ALL_COMPANIES(c) {
if ((HasBit(this->town->have_ratings, c->index) || this->town->exclusivity == c->index)) {
- DrawCompanyIcon(c->index, icon_left, y + sprite_y_offset);
+ DrawCompanyIcon(c->index, icon_left, y + icon_y_offset);
SetDParam(0, c->index);
SetDParam(1, c->index);
@@ -166,7 +171,7 @@ public:
SetDParam(2, str);
if (this->town->exclusivity == c->index) {
- DrawSprite(SPR_BLOT, PALETTE_TO_RED, exclusive_left, y + sprite_y_offset);
+ DrawSprite(SPR_BLOT, PALETTE_TO_RED, exclusive_left, y + exlusive_y_offset);
}
DrawString(text_left, text_right, y, STR_LOCAL_AUTHORITY_COMPANY_RATING);
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5c922c0f1..223100d49 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1023,7 +1023,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
int image_left = (rtl && show_orderlist) ? orderlist_right : text_left;
int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right;
- int vehicle_button_x = rtl ? right - 8 : left;
+ int vehicle_button_x = rtl ? right - GetSpriteSize(SPR_BLOT).width : left;
int y = r.top;
uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->vehicles.Length());