Fixed multiplayer chat
Conflicts: src/network/network_gui.cpp
This commit is contained in:
@@ -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<NWidgetBase>(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<NWidgetBase>(WID_CL_PANEL)->pos_y;
|
||||
int item = -1;
|
||||
if (IsInsideMM(pt.y, WD_FRAMERECT_TOP, this->GetWidget<NWidgetBase>(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! */
|
||||
|
||||
Reference in New Issue
Block a user