Core/Misc: Optimized locale loading

This commit is contained in:
Shauren
2014-08-15 11:36:11 +02:00
parent c212c4fcc3
commit 2fdc4723c2
4 changed files with 30 additions and 30 deletions
@@ -2584,7 +2584,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
AchievementRewardLocale& data = m_achievementRewardLocales[entry];
for (int i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
@@ -2593,7 +2593,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)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));
}
AchievementEntry const* AchievementGlobalMgr::GetAchievement(uint32 achievementId) const
+24 -24
View File
@@ -315,7 +315,7 @@ void ObjectMgr::LoadCreatureLocales()
CreatureLocale& data = _creatureLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name);
@@ -323,7 +323,7 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u creature locale strings in %u ms", uint32(_creatureLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -351,7 +351,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
GossipMenuItemsLocale& data = _gossipMenuItemsLocaleStore[MAKE_PAIR32(menuId, id)];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText);
@@ -360,7 +360,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option locale strings in %u ms", uint32(_gossipMenuItemsLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointOfInterestLocales()
@@ -382,11 +382,11 @@ void ObjectMgr::LoadPointOfInterestLocales()
PointOfInterestLocale& data = _pointOfInterestLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u points_of_interest locale strings in %u ms", uint32(_pointOfInterestLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplates()
@@ -2198,7 +2198,7 @@ void ObjectMgr::LoadItemLocales()
ItemLocale& data = _itemLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name);
@@ -2206,7 +2206,7 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u Item locale strings in %u ms", uint32(_itemLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplates()
@@ -2840,7 +2840,7 @@ void ObjectMgr::LoadItemSetNameLocales()
ItemSetNameLocale& data = _itemSetNameLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow());
@@ -4522,7 +4522,7 @@ void ObjectMgr::LoadQuestLocales()
QuestLocale& data = _questLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
@@ -4539,7 +4539,7 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u Quest locale strings in %u ms", uint32(_questLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadScripts(ScriptsType type)
@@ -5151,11 +5151,11 @@ void ObjectMgr::LoadPageTextLocales()
PageTextLocale& data = _pageTextLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadInstanceTemplate()
@@ -5399,10 +5399,10 @@ void ObjectMgr::LoadNpcTextLocales()
NpcTextLocale& data = _npcTextLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
for (uint8 j = 0; j < MAX_LOCALES; ++j)
for (uint8 j = 0; j < MAX_GOSSIP_TEXT_OPTIONS; ++j)
{
AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString(), locale, data.Text_0[j]);
AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString(), locale, data.Text_1[j]);
@@ -5410,7 +5410,7 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u NpcText locale strings in %u ms", uint32(_npcTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -6434,14 +6434,14 @@ void ObjectMgr::LoadGameObjectLocales()
GameObjectLocale& data = _gameObjectLocaleStore[entry];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u gameobject locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -7757,7 +7757,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
data.Content.resize(1);
++count;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content);
} while (result->NextRow());
@@ -8779,11 +8779,11 @@ void ObjectMgr::LoadBroadcastTextLocales()
continue;
}
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = LocaleConstant(i);
ObjectMgr::AddLocaleString(fields[1 + (i - 1)].GetString(), locale, bct->second.MaleText);
ObjectMgr::AddLocaleString(fields[9 + (i - 1)].GetString(), locale, bct->second.FemaleText);
AddLocaleString(fields[1 + (i - 1)].GetString(), locale, bct->second.MaleText);
AddLocaleString(fields[9 + (i - 1)].GetString(), locale, bct->second.FemaleText);
}
++count;
+3 -3
View File
@@ -51,10 +51,10 @@ struct PageTextLocale
struct NpcTextLocale
{
NpcTextLocale() { Text_0.resize(8); Text_1.resize(8); }
NpcTextLocale() { }
std::vector<StringVector> Text_0;
std::vector<StringVector> Text_1;
StringVector Text_0[MAX_GOSSIP_TEXT_OPTIONS];
StringVector Text_1[MAX_GOSSIP_TEXT_OPTIONS];
};
#endif
+1 -1
View File
@@ -180,7 +180,7 @@ void CreatureTextMgr::LoadCreatureTextLocales()
{
Field* fields = result->Fetch();
CreatureTextLocale& loc = mLocaleTextMap[CreatureTextId(fields[0].GetUInt32(), uint32(fields[1].GetUInt8()), uint32(fields[2].GetUInt8()))];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = LocaleConstant(i);
ObjectMgr::AddLocaleString(fields[3 + i - 1].GetString(), locale, loc.Text);