Core: more cleanup at locale handling.
Also fixes some problems mainly with non English languages. --HG-- branch : trunk
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user