Core/Locales: ported locale string moving optimization from master branch
This commit is contained in:
1 parent
122b52b079
commit
b5ad731cf3
4 files changed
+37
-50
No files matched your search
@@ -3714,8 +3714,10 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
|||||||
|
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
std::string subject = fields[2].GetString();
|
|
||||||
std::string text = fields[3].GetString();
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
|
if (locale == LOCALE_enUS)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (m_achievementRewards.find(id) == m_achievementRewards.end())
|
if (m_achievementRewards.find(id) == m_achievementRewards.end())
|
||||||
{
|
{
|
||||||
@@ -3724,12 +3726,8 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
|||||||
}
|
}
|
||||||
|
|
||||||
AchievementRewardLocale& data = m_achievementRewardLocales[id];
|
AchievementRewardLocale& data = m_achievementRewardLocales[id];
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
ObjectMgr::AddLocaleString(fields[2].GetString(), locale, data.Subject);
|
||||||
if (locale == LOCALE_enUS)
|
ObjectMgr::AddLocaleString(fields[3].GetString(), locale, data.Text);
|
||||||
continue;
|
|
||||||
|
|
||||||
ObjectMgr::AddLocaleString(subject, locale, data.Subject);
|
|
||||||
ObjectMgr::AddLocaleString(text, locale, data.Text);
|
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u achievement reward locale strings in %u ms.", uint32(m_achievementRewardLocales.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u achievement reward locale strings in %u ms.", uint32(m_achievementRewardLocales.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|||||||
@@ -286,14 +286,14 @@ ObjectMgr::~ObjectMgr()
|
|||||||
delete itr->second;
|
delete itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::AddLocaleString(std::string const& value, LocaleConstant localeConstant, std::vector<std::string>& data)
|
void ObjectMgr::AddLocaleString(std::string const&& value, LocaleConstant localeConstant, std::vector<std::string>& data)
|
||||||
{
|
{
|
||||||
if (!value.empty())
|
if (!value.empty())
|
||||||
{
|
{
|
||||||
if (data.size() <= size_t(localeConstant))
|
if (data.size() <= size_t(localeConstant))
|
||||||
data.resize(localeConstant + 1);
|
data.resize(localeConstant + 1);
|
||||||
|
|
||||||
data[localeConstant] = value;
|
data[localeConstant] = std::move(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,18 +343,14 @@ void ObjectMgr::LoadCreatureLocales()
|
|||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
|
|
||||||
std::string name = fields[2].GetString();
|
|
||||||
std::string femaleName = fields[3].GetString();
|
|
||||||
std::string title = fields[4].GetString();
|
|
||||||
|
|
||||||
CreatureLocale& data = _creatureLocaleStore[id];
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddLocaleString(name, locale, data.Name);
|
CreatureLocale& data = _creatureLocaleStore[id];
|
||||||
AddLocaleString(femaleName, locale, data.FemaleName);
|
AddLocaleString(fields[2].GetString(), locale, data.Name);
|
||||||
AddLocaleString(title, locale, data.Title);
|
AddLocaleString(fields[3].GetString(), locale, data.FemaleName);
|
||||||
|
AddLocaleString(fields[4].GetString(), locale, data.Title);
|
||||||
|
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
@@ -411,12 +407,13 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
|||||||
|
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
std::string name = fields[2].GetString();
|
|
||||||
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
|
if (locale == LOCALE_enUS)
|
||||||
|
continue;
|
||||||
|
|
||||||
PointOfInterestLocale& data = _pointOfInterestLocaleStore[id];
|
PointOfInterestLocale& data = _pointOfInterestLocaleStore[id];
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
AddLocaleString(fields[2].GetString(), locale, data.Name);
|
||||||
|
|
||||||
AddLocaleString(name, locale, data.Name);
|
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u points_of_interest locale strings in %u ms", uint32(_pointOfInterestLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u points_of_interest locale strings in %u ms", uint32(_pointOfInterestLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
@@ -4950,10 +4947,12 @@ void ObjectMgr::LoadQuestLocales()
|
|||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
|
|
||||||
QuestLocale& data = _questLocaleStore[id];
|
|
||||||
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
|
if (locale == LOCALE_enUS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QuestLocale& data = _questLocaleStore[id];
|
||||||
AddLocaleString(fields[2].GetString(), locale, data.Title);
|
AddLocaleString(fields[2].GetString(), locale, data.Title);
|
||||||
AddLocaleString(fields[3].GetString(), locale, data.Details);
|
AddLocaleString(fields[3].GetString(), locale, data.Details);
|
||||||
AddLocaleString(fields[4].GetString(), locale, data.Objectives);
|
AddLocaleString(fields[4].GetString(), locale, data.Objectives);
|
||||||
@@ -5599,15 +5598,13 @@ void ObjectMgr::LoadPageTextLocales()
|
|||||||
|
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
std::string text = fields[2].GetString();
|
|
||||||
|
|
||||||
PageTextLocale& data = _pageTextLocaleStore[id];
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
|
|
||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddLocaleString(text, locale, data.Text);
|
PageTextLocale& data = _pageTextLocaleStore[id];
|
||||||
|
AddLocaleString(fields[2].GetString(), locale, data.Text);
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
@@ -6193,14 +6190,13 @@ void ObjectMgr::LoadQuestGreetingsLocales()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string localeName = fields[2].GetString();
|
std::string localeName = fields[2].GetString();
|
||||||
std::string greeting = fields[3].GetString();
|
|
||||||
|
|
||||||
QuestGreetingLocale& data = _questGreetingLocaleStore[MAKE_PAIR32(id, type)];
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
|
||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddLocaleString(greeting, locale, data.greeting);
|
QuestGreetingLocale& data = _questGreetingLocaleStore[MAKE_PAIR32(id, type)];
|
||||||
|
AddLocaleString(fields[3].GetString(), locale, data.greeting);
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u quest greeting locale strings in %u ms", uint32(_questGreetingLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u quest greeting locale strings in %u ms", uint32(_questGreetingLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
@@ -7039,16 +7035,13 @@ void ObjectMgr::LoadGameObjectLocales()
|
|||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
|
|
||||||
std::string name = fields[2].GetString();
|
|
||||||
std::string castBarCaption = fields[3].GetString();
|
|
||||||
|
|
||||||
GameObjectLocale& data = _gameObjectLocaleStore[id];
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddLocaleString(name, locale, data.Name);
|
GameObjectLocale& data = _gameObjectLocaleStore[id];
|
||||||
AddLocaleString(castBarCaption, locale, data.CastBarCaption);
|
AddLocaleString(fields[2].GetString(), locale, data.Name);
|
||||||
|
AddLocaleString(fields[3].GetString(), locale, data.CastBarCaption);
|
||||||
|
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
@@ -9500,8 +9493,10 @@ void ObjectMgr::LoadBroadcastTextLocales()
|
|||||||
|
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
std::string Text = fields[2].GetString();
|
|
||||||
std::string Text1 = fields[3].GetString();
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
|
if (locale == LOCALE_enUS)
|
||||||
|
continue;
|
||||||
|
|
||||||
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
|
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
|
||||||
if (bct == _broadcastTextStore.end())
|
if (bct == _broadcastTextStore.end())
|
||||||
@@ -9510,12 +9505,8 @@ void ObjectMgr::LoadBroadcastTextLocales()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
AddLocaleString(fields[2].GetString(), locale, bct->second.Text);
|
||||||
if (locale == LOCALE_enUS)
|
AddLocaleString(fields[3].GetString(), locale, bct->second.Text1);
|
||||||
continue;
|
|
||||||
|
|
||||||
AddLocaleString(Text, locale, bct->second.Text);
|
|
||||||
AddLocaleString(Text1, locale, bct->second.Text1);
|
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|||||||
@@ -1571,7 +1571,7 @@ class TC_GAME_API ObjectMgr
|
|||||||
// for wintergrasp only
|
// for wintergrasp only
|
||||||
GraveyardContainer GraveyardStore;
|
GraveyardContainer GraveyardStore;
|
||||||
|
|
||||||
static void AddLocaleString(std::string const& value, LocaleConstant localeConstant, std::vector<std::string>& data);
|
static void AddLocaleString(std::string const&& value, LocaleConstant localeConstant, std::vector<std::string>& data);
|
||||||
static inline void GetLocaleString(std::vector<std::string> const& data, LocaleConstant localeConstant, std::string& value)
|
static inline void GetLocaleString(std::vector<std::string> const& data, LocaleConstant localeConstant, std::string& value)
|
||||||
{
|
{
|
||||||
if (data.size() > size_t(localeConstant) && !data[localeConstant].empty())
|
if (data.size() > size_t(localeConstant) && !data[localeConstant].empty())
|
||||||
|
|||||||
@@ -200,14 +200,12 @@ void CreatureTextMgr::LoadCreatureTextLocales()
|
|||||||
uint32 groupId = fields[1].GetUInt8();
|
uint32 groupId = fields[1].GetUInt8();
|
||||||
uint32 id = fields[2].GetUInt8();
|
uint32 id = fields[2].GetUInt8();
|
||||||
std::string localeName = fields[3].GetString();
|
std::string localeName = fields[3].GetString();
|
||||||
std::string text = fields[4].GetString();
|
|
||||||
|
|
||||||
CreatureTextLocale& data = mLocaleTextMap[CreatureTextId(creatureId, groupId, id)];
|
|
||||||
LocaleConstant locale = GetLocaleByName(localeName);
|
LocaleConstant locale = GetLocaleByName(localeName);
|
||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ObjectMgr::AddLocaleString(text, locale, data.Text);
|
CreatureTextLocale& data = mLocaleTextMap[CreatureTextId(creatureId, groupId, id)];
|
||||||
|
ObjectMgr::AddLocaleString(fields[4].GetString(), locale, data.Text);
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u creature localized texts in %u ms", uint32(mLocaleTextMap.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u creature localized texts in %u ms", uint32(mLocaleTextMap.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|||||||
Reference in new issue
Block a user