Change: remove warning in cheat window and reduce it to a note (#8538)

Although meant as a funny joke towards the player, our social
standards have changed since 2004, and such "jokes" are no
longer acceptable by the community as a whole.

The only value of the message is that people are informed the
information is stored in the savegame. This is mostly useful for
us, developers, as some of those cheats can have side-effects
which people report.

While at it, styled the GUI a bit better, as the way the text
was presented was odd.
This commit is contained in:
Patric Stout 2021-01-09 15:14:59 +01:00 committed by GitHub
parent 8da5cff210
commit 3dbdb1c7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -203,12 +203,14 @@ static const NWidgetPart _nested_cheat_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_C_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY, WID_C_NOTE), SetFill(1, 1), SetDataTip(STR_CHEATS_NOTE, STR_NULL), SetPadding(WD_PAR_VSEP_NORMAL, 4, WD_PAR_VSEP_NORMAL, 4),
EndContainer(),
};
/** GUI for the cheats. */
struct CheatWindow : Window {
int clicked;
int header_height;
int clicked_widget;
uint line_height;
int box_width;
@ -223,8 +225,7 @@ struct CheatWindow : Window {
{
if (widget != WID_C_PANEL) return;
int y = r.top + WD_FRAMERECT_TOP + this->header_height;
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER);
int y = r.top + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL;
bool rtl = _current_text_dir == TD_RTL;
uint box_left = rtl ? r.right - this->box_width - 5 : r.left + 5;
@ -324,14 +325,13 @@ struct CheatWindow : Window {
this->line_height = std::max<uint>(this->line_height, FONT_HEIGHT_NORMAL) + WD_PAR_VSEP_NORMAL;
size->width = width + 20 + this->box_width + SETTING_BUTTON_WIDTH /* stuff on the left */ + 10 /* extra spacing on right */;
this->header_height = GetStringHeight(STR_CHEATS_WARNING, size->width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT) + WD_PAR_VSEP_WIDE;
size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui);
size->height = WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui);
}
void OnClick(Point pt, int widget, int click_count) override
{
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_C_PANEL);
uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / this->line_height;
uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - WD_PAR_VSEP_NORMAL) / this->line_height;
int x = pt.x - wid->pos_x;
bool rtl = _current_text_dir == TD_RTL;
if (rtl) x = wid->current_x - x;

View File

@ -1837,7 +1837,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Are you
# Cheat window
STR_CHEATS :{WHITE}Cheats
STR_CHEATS_TOOLTIP :{BLACK}Checkboxes indicate if you have used this cheat before
STR_CHEATS_WARNING :{BLACK}Warning! You are about to betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity
STR_CHEATS_NOTE :{BLACK}Note: any usage of these settings will be recorded by the savegame
STR_CHEAT_MONEY :{LTBLUE}Increase money by {CURRENCY_LONG}
STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Playing as company: {ORANGE}{COMMA}
STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magic bulldozer (remove industries, unmovable objects): {ORANGE}{STRING1}

View File

@ -12,6 +12,7 @@
/** Widgets of the #CheatWindow class. */
enum CheatWidgets {
WID_C_NOTE, ///< Note on top of panel for use of cheat.
WID_C_PANEL, ///< Panel where all cheats are shown in.
};