25 static const std::string README_FILENAME =
"README.md";
26 static const std::string CHANGELOG_FILENAME =
"changelog.md";
27 static const std::string KNOWN_BUGS_FILENAME =
"known-bugs.md";
28 static const std::string LICENSE_FILENAME =
"COPYING.md";
30 static const std::string WEBSITE_LINK =
"https://www.openttd.org/";
31 static const std::string WIKI_LINK =
"https://wiki.openttd.org/";
32 static const std::string BUGTRACKER_LINK =
"https://bugs.openttd.org/";
33 static const std::string COMMUNITY_LINK =
"https://community.openttd.org/";
51 auto file_path = FioGetDirectory(sp,
BASE_DIR) + filename.data();
62 this->ConstructWindow();
78 void SetStringParameters(
WidgetID widget)
const override
87 if (this->filename == CHANGELOG_FILENAME) {
104 for (
size_t line_index = 0; line_index < this->
lines.size(); ++line_index) {
105 const Line &line = this->
lines[line_index];
106 if (!line.
text.starts_with(
"###"))
continue;
109 this->
lines.resize(line_index - 2);
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);
131 void OnClick([[maybe_unused]]
Point pt,
WidgetID widget, [[maybe_unused]]
int click_count)
override
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);
162 void EnableTextfileButton(std::string_view filename,
WidgetID button_widget)
168 static constexpr
NWidgetPart _nested_helpwin_widgets[] = {
197 _nested_helpwin_widgets
200 void ShowHelpWindow()
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 AfterLoadText() override
Post-processing after the text is loaded.
Window class displaying the help 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.
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.
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
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.