From fa2361738041c28878650a41bb52d8a4482237e4 Mon Sep 17 00:00:00 2001 From: yexo Date: Mon, 4 Jan 2010 23:00:19 +0000 Subject: (svn r18729) -Fix [FS#3427]: the lock in the company gui was only drawn for your own company --- src/company_gui.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 67c6a9ea4..42a0a6cc0 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1590,6 +1590,7 @@ enum CompanyWindowWidgets { CW_WIDGET_SELECT_RELOCATE, ///< View/hide the 'Relocate HQ' button. CW_WIDGET_RELOCATE_HQ, + CW_WIDGET_HAS_PASSWORD, ///< Draw a lock when the company has a password CW_WIDGET_SELECT_MULTIPLAYER, ///< Multiplayer selection panel. CW_WIDGET_COMPANY_PASSWORD, CW_WIDGET_COMPANY_JOIN, @@ -1647,10 +1648,13 @@ static const NWidgetPart _nested_company_widgets[] = { NWidget(NWID_VERTICAL), SetPIP(4, 2, 4), NWidget(NWID_SPACER), SetMinimalSize(90, 0), SetFill(0, 1), /* Multi player buttons. */ - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_MULTIPLAYER), - NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP), + NWidget(NWID_HORIZONTAL), + NWidget(WWT_EMPTY, COLOUR_GREY, CW_WIDGET_HAS_PASSWORD), + NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_MULTIPLAYER), + NWidget(NWID_SPACER), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP), + EndContainer(), EndContainer(), EndContainer(), EndContainer(), @@ -1811,6 +1815,12 @@ struct CompanyWindow : Window size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_SHARES_OWNED_BY).width); } } break; + +#ifdef ENABLE_NETWORK + case CW_WIDGET_HAS_PASSWORD: + *size = maxdim(*size, GetSpriteSize(SPR_LOCK)); + break; +#endif /* ENABLE_NETWORK */ } } @@ -1877,9 +1887,9 @@ struct CompanyWindow : Window } break; #ifdef ENABLE_NETWORK - case CW_WIDGET_COMPANY_PASSWORD: + case CW_WIDGET_HAS_PASSWORD: if (_networking && NetworkCompanyIsPassworded(c->index)) { - DrawSprite(SPR_LOCK, PAL_NONE, _dynlang.text_dir == TD_RTL ? r.right + 10 : r.left - 10, r.top + 2); + DrawSprite(SPR_LOCK, PAL_NONE, r.left, r.top); } break; #endif /* ENABLE_NETWORK */ -- cgit v1.2.3-70-g09d2