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";
30static const std::string WEBSITE_LINK =
"https://www.openttd.org/";
31static const std::string WIKI_LINK =
"https://wiki.openttd.org/";
32static const std::string BUGTRACKER_LINK =
"https://bugs.openttd.org/";
33static const std::string COMMUNITY_LINK =
"https://community.openttd.org/";
51 auto file_path = FioGetDirectory(sp,
BASE_DIR) + filename.data();
62 this->ConstructWindow();
87 if (this->filename == CHANGELOG_FILENAME) {
106 if (!line.
text.starts_with(
"###"))
continue;
125 this->EnableTextfileButton(README_FILENAME, WID_HW_README);
126 this->EnableTextfileButton(CHANGELOG_FILENAME, WID_HW_CHANGELOG);
127 this->EnableTextfileButton(KNOWN_BUGS_FILENAME, WID_HW_KNOWN_BUGS);
128 this->EnableTextfileButton(LICENSE_FILENAME, WID_HW_LICENSE);
137 case WID_HW_CHANGELOG:
140 case WID_HW_KNOWN_BUGS:
147 OpenBrowser(WEBSITE_LINK);
150 OpenBrowser(WIKI_LINK);
152 case WID_HW_BUGTRACKER:
153 OpenBrowser(BUGTRACKER_LINK);
155 case WID_HW_COMMUNITY:
156 OpenBrowser(COMMUNITY_LINK);
168static constexpr NWidgetPart _nested_helpwin_widgets[] = {
197 _nested_helpwin_widgets
202 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.
@ NO_DIRECTORY
A path without any base directory.
@ BASE_DIR
Base directory for all subdirectories.
GUI functions that shouldn't be here.
static std::optional< std::string > FindGameManualFilePath(std::string_view filename)
Find the path to the game manual file.
static constexpr size_t CHANGELOG_VERSIONS_LIMIT
Only show the first 20 changelog versions in the textfile viewer.
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.
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.
int32_t WindowNumber
Number to differentiate different windows of the same class.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.