From d03b27e1f6be9cd62502a9c07de934707309a405 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 4 Sep 2015 22:55:00 +0300 Subject: [PATCH] Fixed multiplayer chat Conflicts: src/network/network_gui.cpp --- src/network/network_chat_gui.cpp | 2 +- src/network/network_gui.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 10358983ae..5b96b1a251 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -462,7 +462,7 @@ struct NetworkChatWindow : public Window { virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) { - Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; + Point pt = { GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) * 2, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; return pt; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index daa4597bc9..f9dfe80ddb 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1781,6 +1781,7 @@ struct NetworkClientListPopupWindow : Window { d = maxdim(GetStringBoundingBox(action->name), d); } + d.height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); d.height *= this->actions.Length(); d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; @@ -1792,23 +1793,23 @@ struct NetworkClientListPopupWindow : Window { /* Draw the actions */ int sel = this->sel_index; int y = r.top + WD_FRAMERECT_TOP; - for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++, y += FONT_HEIGHT_NORMAL) { + for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++, y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL)) { TextColour colour; if (sel-- == 0) { // Selected item, highlight it - GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, PC_BLACK); + GfxFillRect(r.left + 1, y, r.right - 1, y + GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) - 1, PC_BLACK); colour = TC_WHITE; } else { colour = TC_BLACK; } - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, action->name, colour); + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(y, GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL)), action->name, colour); } } virtual void OnMouseLoop() { /* We selected an action */ - uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; + uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); if (_left_button_down) { if (index == this->sel_index || index >= this->actions.Length()) return; @@ -1885,12 +1886,15 @@ struct NetworkClientListWindow : Window { if (ci->client_playas != COMPANY_INACTIVE_CLIENT) num++; } - num *= this->line_height; + num *= GetMinSizing(NWST_STEP, this->line_height); int diff = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget(WID_CL_PANEL)->current_y); /* If height is changed */ if (diff != 0) { ResizeWindow(this, 0, diff); + if (this->height + GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) >= _cur_resolution.height) { + ResizeWindow(this, 0, _cur_resolution.height - this->height - GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL)); + } return false; } return true; @@ -1996,7 +2000,7 @@ struct NetworkClientListWindow : Window { pt.y -= this->GetWidget(WID_CL_PANEL)->pos_y; int item = -1; if (IsInsideMM(pt.y, WD_FRAMERECT_TOP, this->GetWidget(WID_CL_PANEL)->current_y - WD_FRAMERECT_BOTTOM)) { - item = (pt.y - WD_FRAMERECT_TOP) / this->line_height; + item = (pt.y - WD_FRAMERECT_TOP) / GetMinSizing(NWST_STEP, this->line_height); } /* It did not change.. no update! */