summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-09 15:14:59 +0100
committerGitHub <noreply@github.com>2021-01-09 15:14:59 +0100
commit3dbdb1c7e3d5b7561d87d2cf891809324064bc1c (patch)
treec7e4fe806d9b84d5e2a6f059c91e066f8d312a2a
parent8da5cff21065501303db98e2e575ac1202157985 (diff)
downloadopenttd-3dbdb1c7e3d5b7561d87d2cf891809324064bc1c.tar.xz
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.
-rw-r--r--src/cheat_gui.cpp12
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/widgets/cheat_widget.h1
3 files changed, 8 insertions, 7 deletions
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index d83cd3996..3a40fb21d 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -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;
diff --git a/src/lang/english.txt b/src/lang/english.txt
index a0cf2b9a0..6f2168f20 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -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}
diff --git a/src/widgets/cheat_widget.h b/src/widgets/cheat_widget.h
index c43799d5d..b8ee75f52 100644
--- a/src/widgets/cheat_widget.h
+++ b/src/widgets/cheat_widget.h
@@ -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.
};