diff options
-rw-r--r-- | src/network/network_gui.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index eb7ff78b2..3e799221d 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -29,6 +29,7 @@ #include "../genworld.h" #include "../map_type.h" #include "../guitimer_func.h" +#include "../zoom_func.h" #include "../widgets/network_widget.h" @@ -380,6 +381,7 @@ protected: /* offsets to vertically centre text and icons */ int text_y_offset = (this->resize.step_height - FONT_HEIGHT_NORMAL) / 2 + 1; int icon_y_offset = (this->resize.step_height - GetSpriteSize(SPR_BLOT).height) / 2; + int lock_y_offset = (this->resize.step_height - GetSpriteSize(SPR_LOCK).height) / 2; DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + text_y_offset, cur_item->info.server_name, TC_BLACK); @@ -424,13 +426,13 @@ protected: } /* draw a lock if the server is password protected */ - if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, nwi_info->pos_x + this->lock_offset, y + icon_y_offset - 1); + if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, nwi_info->pos_x + this->lock_offset, y + lock_y_offset); /* draw red or green icon, depending on compatibility with server */ - DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), nwi_info->pos_x + this->blot_offset, y + icon_y_offset); + DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), nwi_info->pos_x + this->blot_offset, y + icon_y_offset + 1); /* draw flag according to server language */ - DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, nwi_info->pos_x + this->flag_offset, y + icon_y_offset); + DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, nwi_info->pos_x + this->flag_offset, y + (this->resize.step_height - GetSpriteSize(SPR_FLAGS_BASE + cur_item->info.server_lang).height) / 2); } } @@ -1359,7 +1361,7 @@ struct NetworkLobbyWindow : public Window { break; case WID_NL_MATRIX: - resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; + resize->height = WD_MATRIX_TOP + std::max<uint>(std::max(GetSpriteSize(SPR_LOCK).height, GetSpriteSize(SPR_PROFIT_LOT).height), FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; @@ -1413,31 +1415,32 @@ struct NetworkLobbyWindow : public Window { bool rtl = _current_text_dir == TD_RTL; uint left = r.left + WD_FRAMERECT_LEFT; uint right = r.right - WD_FRAMERECT_RIGHT; + uint text_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - FONT_HEIGHT_NORMAL) / 2 + WD_MATRIX_TOP; 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; + int lock_y_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - lock_size.height) / 2 + WD_MATRIX_TOP; Dimension profit_size = GetSpriteSize(SPR_PROFIT_LOT); int profit_width = lock_size.width; - int profit_y_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - profit_size.height) / 2; + int profit_y_offset = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - profit_size.height) / 2 + WD_MATRIX_TOP; 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; + int y = r.top; /* Draw company list */ int pos = this->vscroll->GetPosition(); while (pos < this->server->info.companies_on) { byte company = NetworkLobbyFindCompanyIndex(pos); bool income = false; if (this->company == company) { - GfxFillRect(r.left + 1, y - 2, r.right - 1, y + FONT_HEIGHT_NORMAL, PC_GREY); // show highlighted item with a different colour + GfxFillRect(r.left + WD_BEVEL_LEFT, y + 1, r.right - WD_BEVEL_RIGHT, y + this->resize.step_height - 2, PC_GREY); // show highlighted item with a different colour } - DrawString(text_left, text_right, y, this->company_info[company].company_name, TC_BLACK); + DrawString(text_left, text_right, y + text_offset, this->company_info[company].company_name, TC_BLACK); 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 */ |