Merge tag '1.11.0-beta2' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release.yml # CMakeLists.txt # src/blitter/32bpp_optimized.cpp # src/debug.cpp # src/gfx.cpp # src/gfx_func.h # src/lang/czech.txt # src/lang/english.txt # src/lang/italian.txt # src/lang/swedish.txt # src/lang/ukrainian.txt # src/network/network_server.cpp # src/os/windows/crashlog_win.cpp # src/os/windows/win32.cpp # src/pathfinder/follow_track.hpp # src/screenshot.cpp # src/settings_type.h # src/spritecache.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/video_driver.cpp # src/video/video_driver.hpp # src/video/win32_v.cpp
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "../newgrf.h"
|
||||
#include "../error.h"
|
||||
#include "../guitimer_func.h"
|
||||
#include "../zoom_func.h"
|
||||
|
||||
#include "../widgets/network_widget.h"
|
||||
|
||||
@@ -395,6 +396,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);
|
||||
|
||||
@@ -439,13 +441,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1374,7 +1376,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;
|
||||
|
||||
@@ -1428,31 +1430,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 */
|
||||
|
Reference in New Issue
Block a user