25static const std::string README_FILENAME =
"README.md";
26static const std::string CHANGELOG_FILENAME =
"changelog.md";
27static const std::string KNOWN_BUGS_FILENAME =
"known-bugs.md";
28static const std::string LICENSE_FILENAME =
"COPYING.md";
29static const std::string FONTS_FILENAME =
"fonts.md";
31static const std::string WEBSITE_LINK =
"https://www.openttd.org/";
32static const std::string WIKI_LINK =
"https://wiki.openttd.org/";
33static const std::string BUGTRACKER_LINK =
"https://bugs.openttd.org/";
34static const std::string COMMUNITY_LINK =
"https://community.openttd.org/";
52 auto file_path = FioGetDirectory(sp, subdir) + filename.data();
63 this->ConstructWindow();
88 if (this->filename == CHANGELOG_FILENAME) {
107 if (!line.
text.starts_with(
"###"))
continue;
126 this->EnableTextfileButton(README_FILENAME,
BASE_DIR, WID_HW_README);
127 this->EnableTextfileButton(CHANGELOG_FILENAME,
BASE_DIR, WID_HW_CHANGELOG);
128 this->EnableTextfileButton(KNOWN_BUGS_FILENAME,
BASE_DIR, WID_HW_KNOWN_BUGS);
129 this->EnableTextfileButton(LICENSE_FILENAME,
BASE_DIR, WID_HW_LICENSE);
130 this->EnableTextfileButton(FONTS_FILENAME,
DOCS_DIR, WID_HW_FONTS);
139 case WID_HW_CHANGELOG:
142 case WID_HW_KNOWN_BUGS:
152 OpenBrowser(WEBSITE_LINK);
155 OpenBrowser(WIKI_LINK);
157 case WID_HW_BUGTRACKER:
158 OpenBrowser(BUGTRACKER_LINK);
160 case WID_HW_COMMUNITY:
161 OpenBrowser(COMMUNITY_LINK);
173static constexpr NWidgetPart _nested_helpwin_widgets[] = {
203 _nested_helpwin_widgets
208 AllocateWindowDescFront<HelpWindow>(_helpwin_desc, 0);
Control codes that are embedded in the translation strings.
bool FioCheckFileExists(const std::string &filename, Subdirectory subdir)
Check whether the given file exists.
Functions for Standard In/Out file operations.
Searchpath
Types of searchpaths OpenTTD might use.
@ SP_SHARED_DIR
Search in the shared directory, like 'Shared Files' under Windows.
@ SP_INSTALLATION_DIR
Search in the installation directory.
@ SP_BINARY_DIR
Search in the directory where the binary resides.
@ SP_WORKING_DIR
Search in the working directory.
@ SP_APPLICATION_BUNDLE_DIR
Search within the application bundle.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
@ NO_DIRECTORY
A path without any base directory.
@ BASE_DIR
Base directory for all subdirectories.
@ DOCS_DIR
Subdirectory for documentation.
GUI functions that shouldn't be here.
static constexpr size_t CHANGELOG_VERSIONS_LIMIT
Only show the first 20 changelog versions in the textfile viewer.
static std::optional< std::string > FindGameManualFilePath(std::string_view filename, Subdirectory subdir)
Find the path to the game manual file.
GUI to access manuals and related.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Functions related to low-level strings.
void SetDParamStr(size_t n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
Window class displaying the game manual textfile viewer.
void AfterLoadChangelog()
For changelog files, truncate the file after CHANGELOG_VERSIONS_LIMIT versions.
void SetStringParameters(WidgetID widget) const override
Initialize string parameters for a widget.
void AfterLoadText() override
Post-processing after the text is loaded.
Window class displaying the help window.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Coordinates of a point in 2D.
std::string text
Contents of the line.
Window for displaying a textfile.
bool trusted
Whether the content is trusted (read: not from content like NewGRFs, etc).
std::vector< Line > lines
#text, split into lines in a table with lines.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
virtual void AfterLoadText()
Post-processing after the text is loaded.
std::string filepath
Full path to the filename.
std::vector< Hyperlink > link_anchors
Anchor names of headings that can be linked to.
std::string filename
Filename of the textfile.
virtual void LoadTextfile(const std::string &textfile, Subdirectory dir)
Loads the textfile text from file and setup lines.
High level window description.
Number to differentiate different windows of the same class.
Data structure for an opened window.
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
GUI functions related to textfiles.
@ TFT_GAME_MANUAL
Game manual/documentation file.
Functions, definitions and such used only by the GUI.
@ WDP_CENTER
Center the window.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.