summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-18 13:05:55 +0000
committerfrosch <frosch@openttd.org>2011-11-18 13:05:55 +0000
commitb725913f3b57110e18114f1f316e810d1d807e35 (patch)
tree9453f7a6328a47c9db0868be95fce48f7750f81d /src/newgrf_config.cpp
parentb7b74ed7dc0e70cb2ce6931e71f5311600ec3a50 (diff)
downloadopenttd-b725913f3b57110e18114f1f316e810d1d807e35.tar.xz
(svn r23248) -Codechange: Rename everything related to the NewGRF 'readme' to 'textfile', so it is more generic.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 93190cbc9..026b62ff3 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -833,25 +833,27 @@ bool GRFConfig::IsOpenTTDBaseGRF() const
}
/**
- * Search the readme.txt file next to this NewGRF.
- * @return The filename for the readme, \c NULL otherwise.
+ * Search a textfile file next to this NewGRF.
+ * @return The filename for the textfile, \c NULL otherwise.
*/
-const char *GRFConfig::GetReadme() const
+const char *GRFConfig::GetTextfile() const
{
+ static const char prefix[] = "readme";
+
if (this->filename == NULL) return NULL;
- static char readme_path[MAX_PATH];
- strecpy(readme_path, this->filename, lastof(readme_path));
+ static char file_path[MAX_PATH];
+ strecpy(file_path, this->filename, lastof(file_path));
- char *slash = strrchr(readme_path, PATHSEPCHAR);
+ char *slash = strrchr(file_path, PATHSEPCHAR);
if (slash == NULL) return NULL;
- seprintf(slash + 1, lastof(readme_path), "readme_%s.txt", GetCurrentLanguageIsoCode());
- if (FioCheckFileExists(readme_path, NEWGRF_DIR)) return readme_path;
+ seprintf(slash + 1, lastof(file_path), "%s_%s.txt", prefix, GetCurrentLanguageIsoCode());
+ if (FioCheckFileExists(file_path, NEWGRF_DIR)) return file_path;
- seprintf(slash + 1, lastof(readme_path), "readme_%.2s.txt", GetCurrentLanguageIsoCode());
- if (FioCheckFileExists(readme_path, NEWGRF_DIR)) return readme_path;
+ seprintf(slash + 1, lastof(file_path), "%s_%.2s.txt", prefix, GetCurrentLanguageIsoCode());
+ if (FioCheckFileExists(file_path, NEWGRF_DIR)) return file_path;
- strecpy(slash + 1, "readme.txt", lastof(readme_path));
- return FioCheckFileExists(readme_path, NEWGRF_DIR) ? readme_path : NULL;
+ seprintf(slash + 1, lastof(file_path), "%s.txt", prefix);
+ return FioCheckFileExists(file_path, NEWGRF_DIR) ? file_path : NULL;
}