From c5b593a27535b086cd543ce2f0a77aa8fc3ddf67 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 24 Jun 2007 21:04:20 +0000 Subject: [PATCH] added a bcompat hack to deal with upcoming .cfg -> .txt changes in core --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401018 --- core/Translator.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/Translator.cpp b/core/Translator.cpp index a9dcd8b6..d14baa70 100644 --- a/core/Translator.cpp +++ b/core/Translator.cpp @@ -104,6 +104,13 @@ void CPhraseFile::ReparseFile() SMCParseError err; char path[PLATFORM_MAX_PATH]; g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str()); + + /* :HACKHACK: If we're looking for a .txt, see if a .cfg also exists if our .txt does not. */ + if (!g_LibSys.PathExists(path)) + { + UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg"); + } + unsigned int line=0, col=0; if ((err=g_TextParser.ParseFile_SMC(path, this, &line, &col)) != SMCParse_Okay) @@ -650,7 +657,20 @@ void Translator::OnSourceModLevelChange(const char *mapName) void Translator::OnSourceModAllInitialized() { AddLanguage("en", "English"); - unsigned int id = FindOrAddPhraseFile("core.cfg"); + + unsigned int id; + + /* hack -- if core.cfg exists, exec it instead. */ + char path[PLATFORM_MAX_PATH]; + g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "translations/core.cfg"); + + if (g_LibSys.PathExists(path)) + { + id = FindOrAddPhraseFile("core.cfg"); + } else { + id = FindOrAddPhraseFile("core.phrases.txt"); + } + g_pCorePhrases = GetFileByIndex(id); }