Add: Warn players that company passwords are not truly secure

This commit is contained in:
Niels Martin Hansen
2019-01-12 22:27:19 +01:00
parent 66cd32a252
commit dcb2571888
8 changed files with 48 additions and 6 deletions

View File

@@ -981,6 +981,23 @@ struct QueryStringWindow : public Window
resize->width = 0;
size->width = 0;
}
if (widget == WID_QS_WARNINGBOX && (this->flags & QSF_PASSWORD) == 0) {
/* We don't want this widget to show! */
fill->width = 0;
resize->width = 0;
size->width = 0;
}
if (widget == WID_QS_WARNING) {
*size = GetStringBoundingBox(STR_WARNING_PASSWORD_SECURITY);
}
}
virtual void DrawWidget(const Rect &r, int widget) const
{
if (widget != WID_QS_WARNING) return;
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_WARNING_PASSWORD_SECURITY, TC_FROMSTRING, SA_CENTER);
}
void SetStringParameters(int widget) const override
@@ -1037,6 +1054,9 @@ static const NWidgetPart _nested_query_string_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_QS_WARNINGBOX),
NWidget(WWT_LABEL, COLOUR_GREY, WID_QS_WARNING), SetPadding(WD_FRAMETEXT_TOP, WD_FRAMETEXT_RIGHT, WD_FRAMETEXT_BOTTOM, WD_FRAMETEXT_LEFT), SetFill(0, 1),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),