diff options
author | rubidium <rubidium@openttd.org> | 2011-11-10 06:15:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-10 06:15:03 +0000 |
commit | 514d887690f3a4bfa21fe75bef6a697db04aa653 (patch) | |
tree | 81f90d2b99102928f0e1467e598dec8848c60472 /src/newgrf_config.cpp | |
parent | 3e98a7b504ffbcf538618e226def41f095cbb9cd (diff) | |
download | openttd-514d887690f3a4bfa21fe75bef6a697db04aa653.tar.xz |
(svn r23178) -Feature [FS#4780]: in-game readme.txt readmer (LordAro)
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 932e7227e..46dda4abe 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -831,3 +831,21 @@ bool GRFConfig::IsOpenTTDBaseGRF() const { return (this->ident.grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID; } + +/** + * Search the readme.txt file next to this NewGRF. + * @return The filename for the readme, \c NULL otherwise. + */ +const char *GRFConfig::GetReadme() const +{ + if (this->filename == NULL) return NULL; + + static char readme_path[MAX_PATH]; + strecpy(readme_path, this->filename, lastof(readme_path)); + + char *slash = strrchr(readme_path, PATHSEPCHAR); + if (slash == NULL) return NULL; + + strecpy(slash + 1, "readme.txt", lastof(readme_path)); + return FioCheckFileExists(readme_path, NEWGRF_DIR) ? readme_path : NULL; +} |