summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-02-12 10:51:43 +0000
committerrubidium <rubidium@openttd.org>2012-02-12 10:51:43 +0000
commit58269b7ad2a70b94de104ede2c69e126b58be534 (patch)
treed926e442ee19aed1792cdcada332e91ae5512a18 /src/newgrf_config.cpp
parent2a6e23263af057018ce1e90818467aded3dcd55f (diff)
downloadopenttd-58269b7ad2a70b94de104ede2c69e126b58be534.tar.xz
(svn r23935) -Codechange: generalise GetTextfile
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 4c296d20f..352740a59 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -20,6 +20,7 @@
#include "progress.h"
#include "video/video_driver.hpp"
#include "strings_func.h"
+#include "textfile_gui.h"
#include "fileio_func.h"
#include "fios.h"
@@ -878,29 +879,5 @@ bool GRFConfig::IsOpenTTDBaseGRF() const
*/
const char *GRFConfig::GetTextfile(TextfileType type) const
{
- static const char * const prefixes[] = {
- "readme",
- "changelog",
- "license",
- };
- assert_compile(lengthof(prefixes) == TFT_END);
-
- const char *prefix = prefixes[type];
-
- if (this->filename == NULL) return NULL;
-
- static char file_path[MAX_PATH];
- strecpy(file_path, this->filename, lastof(file_path));
-
- char *slash = strrchr(file_path, PATHSEPCHAR);
- if (slash == NULL) return NULL;
-
- seprintf(slash + 1, lastof(file_path), "%s_%s.txt", prefix, GetCurrentLanguageIsoCode());
- if (FioCheckFileExists(file_path, NEWGRF_DIR)) return file_path;
-
- seprintf(slash + 1, lastof(file_path), "%s_%.2s.txt", prefix, GetCurrentLanguageIsoCode());
- if (FioCheckFileExists(file_path, NEWGRF_DIR)) return file_path;
-
- seprintf(slash + 1, lastof(file_path), "%s.txt", prefix);
- return FioCheckFileExists(file_path, NEWGRF_DIR) ? file_path : NULL;
+ return ::GetTextfile(type, NEWGRF_DIR, this->filename);
}