diff -r 70380c431118 src/network/network_gui.cpp --- a/src/network/network_gui.cpp Thu Mar 26 02:36:25 2015 +0300 +++ b/src/network/network_gui.cpp Thu Mar 26 05:42:08 2015 +0300 @@ -31,6 +31,7 @@ #include "../core/geometry_func.hpp" #include "../genworld.h" #include "../map_type.h" +#include "../zoom_func.h" #include "../widgets/network_widget.h" @@ -388,6 +389,7 @@ /* 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); @@ -432,13 +434,13 @@ } /* 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); } } @@ -1386,8 +1388,9 @@ break; case WID_NL_MATRIX: - resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; + resize->height = WD_MATRIX_TOP + max(max(GetSpriteSize(SPR_LOCK).height, GetSpriteSize(SPR_PROFIT_LOT).height), (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; + size->width = ScaleGUITrad(146); break; case WID_NL_DETAILS: @@ -1440,31 +1443,32 @@ 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 - lock_size.height) / 2; 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 - 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; + 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 + 1, y + 1, r.right - 1, y + this->resize.step_height - 1, 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 */