Magic numbers cleanup:
- Replace many magic numbers with constants - Use enum for vehicle flags/seat flags - Correct structure for ItemRandomSuffixEntry --HG-- branch : trunk
This commit is contained in:
@@ -442,7 +442,7 @@ void ObjectMgr::LoadCreatureLocales()
|
||||
|
||||
CreatureLocale& data = mCreatureLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetString();
|
||||
@@ -483,7 +483,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
|
||||
|
||||
GossipMenuItemsLocale& data = mGossipMenuItemsLocaleMap[MAKE_PAIR32(menuId,id)];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[2 + 2 * (i - 1)].GetString();
|
||||
@@ -518,7 +518,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
||||
|
||||
PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.IconName);
|
||||
@@ -1954,7 +1954,7 @@ void ObjectMgr::LoadItemLocales()
|
||||
|
||||
ItemLocale& data = mItemLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetString();
|
||||
@@ -2450,7 +2450,7 @@ void ObjectMgr::LoadItemSetNameLocales()
|
||||
|
||||
ItemSetNameLocale& data = mItemSetNameLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Name);
|
||||
@@ -4318,7 +4318,7 @@ void ObjectMgr::LoadQuests()
|
||||
if (!qinfo->ReqCreatureOrGOId[j])
|
||||
{
|
||||
bool found = false;
|
||||
for (uint8 k = 0; k < 3; ++k)
|
||||
for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
|
||||
{
|
||||
if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
|
||||
spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
|
||||
@@ -4591,7 +4591,7 @@ void ObjectMgr::LoadQuests()
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
for (uint8 j = 0; j < 3; ++j)
|
||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
|
||||
continue;
|
||||
@@ -4648,7 +4648,7 @@ void ObjectMgr::LoadQuestLocales()
|
||||
|
||||
QuestLocale& data = mQuestLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 11 * (i - 1)].GetString();
|
||||
@@ -5087,7 +5087,7 @@ void ObjectMgr::LoadEventScripts()
|
||||
SpellEntry const * spell = sSpellStore.LookupEntry(i);
|
||||
if (spell)
|
||||
{
|
||||
for (uint8 j=0; j<3; ++j)
|
||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
|
||||
{
|
||||
@@ -5326,7 +5326,7 @@ void ObjectMgr::LoadPageTextLocales()
|
||||
|
||||
PageTextLocale& data = mPageTextLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Text);
|
||||
@@ -5417,7 +5417,7 @@ void ObjectMgr::LoadGossipText()
|
||||
|
||||
GossipText& gText = mGossipText[Text_ID];
|
||||
|
||||
for (int i=0; i< 8; i++)
|
||||
for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++)
|
||||
{
|
||||
gText.Options[i].Text_0 = fields[cic++].GetString();
|
||||
gText.Options[i].Text_1 = fields[cic++].GetString();
|
||||
@@ -5425,7 +5425,7 @@ void ObjectMgr::LoadGossipText()
|
||||
gText.Options[i].Language = fields[cic++].GetUInt32();
|
||||
gText.Options[i].Probability = fields[cic++].GetFloat();
|
||||
|
||||
for (uint8 j=0; j < 3; ++j)
|
||||
for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
|
||||
{
|
||||
gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32();
|
||||
gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32();
|
||||
@@ -5466,10 +5466,10 @@ void ObjectMgr::LoadNpcTextLocales()
|
||||
|
||||
NpcTextLocale& data = mNpcTextLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
for (uint8 j = 0; j < 8; ++j)
|
||||
for (uint8 j = 0; j < MAX_LOCALES; ++j)
|
||||
{
|
||||
std::string str0 = fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString();
|
||||
AddLocaleString(str0, locale, data.Text_0[j]);
|
||||
@@ -6527,15 +6527,15 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||
|
||||
GameObjectLocale& data = mGameObjectLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Name);
|
||||
}
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i + (MAX_LOCALE - 1)].GetString();
|
||||
std::string str = fields[i + (TOTAL_LOCALES - 1)].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.CastBarCaption);
|
||||
}
|
||||
|
||||
@@ -7979,7 +7979,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
|
||||
data.Content.resize(1);
|
||||
++count;
|
||||
|
||||
for (uint8 i = 0; i < MAX_LOCALE; ++i)
|
||||
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
std::string str = fields[i + 1].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Content);
|
||||
|
||||
Reference in New Issue
Block a user