summaryrefslogtreecommitdiff
path: root/src/cheat_gui.cpp
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 /src/cheat_gui.cpp
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.
Diffstat (limited to 'src/cheat_gui.cpp')
-rw-r--r--src/cheat_gui.cpp12
1 files changed, 6 insertions, 6 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;