OpenTTD Source 20241224-master-gee860a5c8e
help_gui.cpp File Reference

GUI to access manuals and related. More...

#include "stdafx.h"
#include "gui.h"
#include "window_gui.h"
#include "textfile_gui.h"
#include "fileio_func.h"
#include "table/control_codes.h"
#include "string_func.h"
#include "openttd.h"
#include "help_gui.h"
#include "widgets/help_widget.h"
#include "widgets/misc_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  GameManualTextfileWindow
 Window class displaying the game manual textfile viewer. More...
 
struct  HelpWindow
 Window class displaying the help window. More...
 

Functions

static std::optional< std::string > FindGameManualFilePath (std::string_view filename)
 Find the path to the game manual file.
 
void ShowHelpWindow ()
 

Variables

static const std::string README_FILENAME = "README.md"
 
static const std::string CHANGELOG_FILENAME = "changelog.md"
 
static const std::string KNOWN_BUGS_FILENAME = "known-bugs.md"
 
static const std::string LICENSE_FILENAME = "COPYING.md"
 
static const std::string WEBSITE_LINK = "https://www.openttd.org/"
 
static const std::string WIKI_LINK = "https://wiki.openttd.org/"
 
static const std::string BUGTRACKER_LINK = "https://bugs.openttd.org/"
 
static const std::string COMMUNITY_LINK = "https://community.openttd.org/"
 
static constexpr size_t CHANGELOG_VERSIONS_LIMIT = 20
 Only show the first 20 changelog versions in the textfile viewer.
 
static constexpr NWidgetPart _nested_helpwin_widgets []
 
static WindowDesc _helpwin_desc (WDP_CENTER, nullptr, 0, 0, WC_HELPWIN, WC_NONE, 0, _nested_helpwin_widgets)
 

Detailed Description

GUI to access manuals and related.

Definition in file help_gui.cpp.

Function Documentation

◆ FindGameManualFilePath()

static std::optional< std::string > FindGameManualFilePath ( std::string_view  filename)
static

Find the path to the game manual file.

Parameters
filenameThe filename to find.
Returns
std::string The path to the filename if found.

Definition at line 44 of file help_gui.cpp.

References BASE_DIR, FioCheckFileExists(), NO_DIRECTORY, SP_APPLICATION_BUNDLE_DIR, SP_BINARY_DIR, SP_INSTALLATION_DIR, SP_SHARED_DIR, and SP_WORKING_DIR.

◆ ShowHelpWindow()

void ShowHelpWindow ( )

Definition at line 200 of file help_gui.cpp.

Variable Documentation

◆ _nested_helpwin_widgets

constexpr NWidgetPart _nested_helpwin_widgets[]
staticconstexpr
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_CAPTION, STR_NULL),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(WWT_FRAME, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_WEBSITES, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_WEBSITE), SetDataTip(STR_HELP_WINDOW_MAIN_WEBSITE, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_WIKI), SetDataTip(STR_HELP_WINDOW_MANUAL_WIKI, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_BUGTRACKER), SetDataTip(STR_HELP_WINDOW_BUGTRACKER, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_COMMUNITY), SetDataTip(STR_HELP_WINDOW_COMMUNITY, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_FRAME, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_DOCUMENTS, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_README), SetDataTip(STR_HELP_WINDOW_README, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_CHANGELOG), SetDataTip(STR_HELP_WINDOW_CHANGELOG, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_KNOWN_BUGS),SetDataTip(STR_HELP_WINDOW_KNOWN_BUGS, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_LICENSE), SetDataTip(STR_HELP_WINDOW_LICENSE, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
}
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:96
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:75
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:50
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:61
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:69
@ WWT_FRAME
Frame.
Definition widget_type.h:60

Definition at line 168 of file help_gui.cpp.

◆ BUGTRACKER_LINK

const std::string BUGTRACKER_LINK = "https://bugs.openttd.org/"
static

Definition at line 32 of file help_gui.cpp.

◆ CHANGELOG_FILENAME

const std::string CHANGELOG_FILENAME = "changelog.md"
static

Definition at line 26 of file help_gui.cpp.

◆ CHANGELOG_VERSIONS_LIMIT

constexpr size_t CHANGELOG_VERSIONS_LIMIT = 20
staticconstexpr

Only show the first 20 changelog versions in the textfile viewer.

Definition at line 36 of file help_gui.cpp.

Referenced by GameManualTextfileWindow::AfterLoadChangelog().

◆ COMMUNITY_LINK

const std::string COMMUNITY_LINK = "https://community.openttd.org/"
static

Definition at line 33 of file help_gui.cpp.

◆ KNOWN_BUGS_FILENAME

const std::string KNOWN_BUGS_FILENAME = "known-bugs.md"
static

Definition at line 27 of file help_gui.cpp.

◆ LICENSE_FILENAME

const std::string LICENSE_FILENAME = "COPYING.md"
static

Definition at line 28 of file help_gui.cpp.

◆ README_FILENAME

const std::string README_FILENAME = "README.md"
static

Definition at line 25 of file help_gui.cpp.

◆ WEBSITE_LINK

const std::string WEBSITE_LINK = "https://www.openttd.org/"
static

Definition at line 30 of file help_gui.cpp.

◆ WIKI_LINK

const std::string WIKI_LINK = "https://wiki.openttd.org/"
static

Definition at line 31 of file help_gui.cpp.