mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Globals: cache SpellSpecific and AuraState information instead of computing them each time they're needed
This commit is contained in:
@@ -1028,6 +1028,9 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
|
||||
|
||||
ChainEntry = NULL;
|
||||
ExplicitTargetMask = 0;
|
||||
|
||||
_spellSpecific = SPELL_SPECIFIC_NORMAL;
|
||||
_auraState = AURA_STATE_NONE;
|
||||
}
|
||||
|
||||
SpellInfo::~SpellInfo()
|
||||
|
||||
@@ -560,11 +560,17 @@ public:
|
||||
bool _IsPositiveEffect(uint8 effIndex, bool deep) const;
|
||||
bool _IsPositiveSpell() const;
|
||||
static bool _IsPositiveTarget(uint32 targetA, uint32 targetB);
|
||||
void _LoadSpellSpecific();
|
||||
void _LoadAuraState();
|
||||
void _LoadImmunityInfo();
|
||||
|
||||
// unloading helpers
|
||||
void _UnloadImplicitTargetConditionLists();
|
||||
|
||||
private:
|
||||
SpellSpecificType _spellSpecific;
|
||||
AuraStateType _auraState;
|
||||
|
||||
ImmunityInfo _immunityInfo[MAX_SPELL_EFFECTS];
|
||||
};
|
||||
|
||||
|
||||
@@ -3821,6 +3821,23 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
TC_LOG_INFO("server.loading", ">> Loaded SpellInfo corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void SpellMgr::LoadSpellInfoSpellSpecificAndAuraState()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
for (SpellInfo* spellInfo : mSpellInfoMap)
|
||||
{
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
// AuraState depends on SpellSpecific
|
||||
spellInfo->_LoadSpellSpecific();
|
||||
spellInfo->_LoadAuraState();
|
||||
}
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Loaded SpellInfo SpellSpecific and AuraState in %u ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void SpellMgr::LoadSpellInfoImmunities()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -684,6 +684,7 @@ class TC_GAME_API SpellMgr
|
||||
void UnloadSpellInfoImplicitTargetConditionLists();
|
||||
void LoadSpellInfoCustomAttributes();
|
||||
void LoadSpellInfoCorrections();
|
||||
void LoadSpellInfoSpellSpecificAndAuraState();
|
||||
void LoadSpellInfoImmunities();
|
||||
|
||||
private:
|
||||
|
||||
@@ -1506,6 +1506,9 @@ void World::SetInitialWorldSettings()
|
||||
TC_LOG_INFO("server.loading", "Loading SpellInfo custom attributes...");
|
||||
sSpellMgr->LoadSpellInfoCustomAttributes();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading SpellInfo SpellSpecific and AuraState...");
|
||||
sSpellMgr->LoadSpellInfoSpellSpecificAndAuraState();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading SpellInfo immunity infos...");
|
||||
sSpellMgr->LoadSpellInfoImmunities();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user