mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Spells: Optimized spell effect info loading
This commit is contained in:
@@ -130,7 +130,7 @@ char const SpellCastTimefmt[] = "nixx";
|
||||
char const SpellCategoriesEntryfmt[] = "diiiiiiiix";
|
||||
char const SpellCategoryfmt[] = "nixxxx";
|
||||
char const SpellDurationfmt[] = "niii";
|
||||
char const SpellEffectEntryfmt[] = "niifiiiffiiiiiifiifiiiiifiiiiif";
|
||||
char const SpellEffectEntryfmt[] = "iiifiiiffiiiiiifiifiiiiifiiiiif";
|
||||
const std::string CustomSpellEffectEntryfmt = "ppppppppppppppappppppppppp";
|
||||
const std::string CustomSpellEffectEntryIndex = "Id";
|
||||
char const SpellEntryfmt[] = "nsxxxiiiiiiiiiiiiiiiiiii";
|
||||
|
||||
@@ -3088,7 +3088,12 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons
|
||||
{
|
||||
// overwrite any existing effect from DIFFICULTY_NONE
|
||||
if (effect)
|
||||
{
|
||||
if (effect->EffectIndex >= effList.size())
|
||||
effList.resize(effect->EffectIndex + 1);
|
||||
|
||||
effList[effect->EffectIndex] = effect;
|
||||
}
|
||||
}
|
||||
// if we found any effect in our difficulty then stop searching
|
||||
break;
|
||||
|
||||
@@ -2760,15 +2760,18 @@ void SpellMgr::LoadSpellInfoStore()
|
||||
SpellEffectEntry const* effect = sSpellEffectStore.LookupEntry(i);
|
||||
if (!effect)
|
||||
continue;
|
||||
|
||||
|
||||
if (effect->EffectIndex >= MAX_SPELL_EFFECTS)
|
||||
{
|
||||
TC_LOG_ERROR("server.loading", "Spell %u has invalid EffectIndex %u, max is %u, skipped", i, effect->EffectIndex, uint32(MAX_SPELL_EFFECTS));
|
||||
continue;
|
||||
}
|
||||
|
||||
effectsBySpell[effect->SpellID][effect->DifficultyID].resize(MAX_SPELL_EFFECTS);
|
||||
effectsBySpell[effect->SpellID][effect->DifficultyID][effect->EffectIndex] = effect;
|
||||
SpellEffectEntryVector& effectsForDifficulty = effectsBySpell[effect->SpellID][effect->DifficultyID];
|
||||
if (effectsForDifficulty.size() <= effect->EffectIndex)
|
||||
effectsForDifficulty.resize(effect->EffectIndex + 1);
|
||||
|
||||
effectsForDifficulty[effect->EffectIndex] = effect;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
|
||||
|
||||
Reference in New Issue
Block a user