Core: more cleanup at locale handling.
Also fixes some problems mainly with non English languages. --HG-- branch : trunk
This commit is contained in:
@@ -1678,9 +1678,8 @@ valid examples:
|
||||
ItemLocale const *il = sObjectMgr.GetItemLocale(linkedItem->ItemId);
|
||||
|
||||
bool foundName = false;
|
||||
for (uint8 i = LOCALE_koKR; i < MAX_LOCALE; ++i)
|
||||
for (uint8 dbIndex = LOCALE_koKR; dbIndex < MAX_LOCALE; ++dbIndex)
|
||||
{
|
||||
int8 dbIndex = sObjectMgr.GetIndexForLocale(LocaleConstant(i));
|
||||
if (dbIndex == -1 || il == NULL || uint8(dbIndex) >= il->Name.size())
|
||||
// using strange database/client combinations can lead to this case
|
||||
expectedName = linkedItem->Name1;
|
||||
@@ -1689,7 +1688,7 @@ valid examples:
|
||||
if (suffix)
|
||||
{
|
||||
expectedName += " ";
|
||||
expectedName += suffix[i];
|
||||
expectedName += suffix[dbIndex];
|
||||
}
|
||||
if (expectedName == buffer)
|
||||
{
|
||||
|
||||
@@ -415,14 +415,10 @@ void ObjectMgr::AddLocaleString(std::string& s, LocaleConstant locale, StringVec
|
||||
{
|
||||
if (!s.empty())
|
||||
{
|
||||
int idx = GetOrNewIndexForLocale(locale);
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (data.size() <= size_t(idx))
|
||||
data.resize(idx + 1);
|
||||
if (data.size() <= size_t(locale))
|
||||
data.resize(locale + 1);
|
||||
|
||||
data[idx] = s;
|
||||
}
|
||||
data[locale] = s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7643,33 +7639,6 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name)
|
||||
return PET_NAME_SUCCESS;
|
||||
}
|
||||
|
||||
LocaleConstant ObjectMgr::GetIndexForLocale(LocaleConstant loc)
|
||||
{
|
||||
for (size_t i=0; i < m_LocalForIndex.size(); ++i)
|
||||
if (m_LocalForIndex[i] == loc)
|
||||
return loc;
|
||||
|
||||
return DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
LocaleConstant ObjectMgr::GetLocaleForIndex(int i)
|
||||
{
|
||||
if (i < 0 || i >= int(m_LocalForIndex.size()))
|
||||
return DEFAULT_LOCALE;
|
||||
|
||||
return m_LocalForIndex[i];
|
||||
}
|
||||
|
||||
int ObjectMgr::GetOrNewIndexForLocale(LocaleConstant loc)
|
||||
{
|
||||
for (size_t i = 0; i < m_LocalForIndex.size(); ++i)
|
||||
if (m_LocalForIndex[i] == loc)
|
||||
return i;
|
||||
|
||||
m_LocalForIndex.push_back(loc);
|
||||
return m_LocalForIndex.size() - 1;
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameObjectForQuests()
|
||||
{
|
||||
mGameObjectForQuestSet.clear(); // need for reload case
|
||||
|
||||
@@ -866,7 +866,7 @@ class ObjectMgr
|
||||
const char *GetTrinityString(int32 entry, LocaleConstant locale_idx) const;
|
||||
const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); }
|
||||
LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; }
|
||||
void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); }
|
||||
void SetDBCLocaleIndex(LocaleConstant locale) { DBCLocaleIndex = locale; }
|
||||
|
||||
void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance);
|
||||
void DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid);
|
||||
@@ -905,9 +905,6 @@ class ObjectMgr
|
||||
|
||||
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
||||
|
||||
LocaleConstant GetIndexForLocale(LocaleConstant loc);
|
||||
LocaleConstant GetLocaleForIndex(int i);
|
||||
|
||||
GameTele const* GetGameTele(uint32 id) const
|
||||
{
|
||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||
@@ -954,8 +951,6 @@ class ObjectMgr
|
||||
const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
||||
uint32 GetScriptId(const char *name);
|
||||
|
||||
int GetOrNewIndexForLocale(LocaleConstant loc);
|
||||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
{
|
||||
return SpellClickInfoMapBounds(mSpellClickInfoMap.lower_bound(creature_id),mSpellClickInfoMap.upper_bound(creature_id));
|
||||
|
||||
@@ -52,7 +52,7 @@ _security(sec), _accountId(id), m_expansion(expansion), _logoutTime(0),
|
||||
m_inQueue(false), m_playerLoading(false), m_playerLogout(false),
|
||||
m_playerRecentlyLogout(false), m_playerSave(false),
|
||||
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)),
|
||||
m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)),
|
||||
m_sessionDbLocaleIndex(locale),
|
||||
m_latency(0), m_TutorialsChanged(false), recruiterId(recruiter)
|
||||
{
|
||||
if (sock)
|
||||
|
||||
Reference in New Issue
Block a user