Code change for the acquisition of the locale

The original code was making use of a structure that is used for races
(Human, Orc, etc), which was rather an odd thing to do.

Seeing as the code would not work in this core, I took the opportunity
to rewrite it so that it checked that actual local file instead.
This commit is contained in:
Charles A Edwards 2016-08-03 16:31:45 +01:00 committed by Antz
parent 3a9b00aafd
commit 95f9c41ab0
3 changed files with 47 additions and 2 deletions

View file

@ -289,6 +289,23 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale
return false;
}
int ReadDBCLocale(const std::string sDataPath)
{
std::string sDBCpath = sDataPath + "dbc/";
std::string sFilename;
for (int uLocaleIndex = 0; uLocaleIndex < MAX_LOCALE; ++uLocaleIndex)
{
sFilename = sDBCpath + "component.wow-" + fullLocaleNameList[uLocaleIndex].name + ".txt";
if (FILE* file = fopen(sFilename.c_str(), "rb"))
{
return uLocaleIndex; // Successfully located the locale
}
}
return -1; // Failed to locate or access the component.wow<locale>.txt file
}
static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const*&localeNameStr)
{
std::string text;