diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c9d83a3242c..e996716fcbd 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1710,24 +1710,18 @@ void SpellMgr::LoadSpellProcs() TC_LOG_INFO("server.loading", ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); // Define can trigger auras - bool isTriggerAura[TOTAL_AURAS]; + bool isTriggerAura[TOTAL_AURAS] = { }; // Triggered always, even from triggered spells - bool isAlwaysTriggeredAura[TOTAL_AURAS]; + bool isAlwaysTriggeredAura[TOTAL_AURAS] = { }; // SpellTypeMask to add to the proc - uint32 spellTypeMask[TOTAL_AURAS]; + std::array spellTypeMask = { }; + spellTypeMask.fill(PROC_SPELL_TYPE_MASK_ALL); // List of auras that CAN trigger but may not exist in spell_proc // in most cases needed to drop charges // some aura types need additional checks (eg SPELL_AURA_MECHANIC_IMMUNITY needs mechanic check) // see AuraEffect::CheckEffectProc - for (uint16 i = 0; i < TOTAL_AURAS; ++i) - { - isTriggerAura[i] = false; - isAlwaysTriggeredAura[i] = false; - spellTypeMask[i] = PROC_SPELL_TYPE_MASK_ALL; - } - isTriggerAura[SPELL_AURA_DUMMY] = true; // Most dummy auras should require scripting, but there are some exceptions (ie 12311) isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true; // "Any direct damaging attack will revive targets" isTriggerAura[SPELL_AURA_MOD_THREAT] = true; // Only one spell: 28762 part of Mage T3 8p bonus @@ -2624,7 +2618,7 @@ void SpellMgr::UnloadSpellInfoImplicitTargetConditionLists() void SpellMgr::UnloadSpellAreaConditions() { - for (auto spellAreaData : mSpellAreaForAreaMap) + for (auto& spellAreaData : mSpellAreaForAreaMap) spellAreaData.second->Conditions.clear(); } @@ -3252,13 +3246,12 @@ void SpellMgr::LoadSpellInfoCorrections() }); // Tree of Life passives - ApplySpellFix({ 5420, 81097 }, [](SpellInfo* spellInfo) { - spellInfo->Stances = 1 << (FORM_TREE - 1); + spellInfo->Stances = uint64(1 << (FORM_TREE - 1)); }); // Elemental Oath diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index ee2473507a5..ba8d7bd435d 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -277,10 +277,12 @@ enum EnchantProcAttributes struct SpellEnchantProcEntry { - float Chance; // if nonzero - overwrite SpellItemEnchantment value - float ProcsPerMinute; // if nonzero - chance to proc is equal to value * aura caster's weapon speed / 60 - uint32 HitMask; // if nonzero - bitmask for matching proc condition based on hit result, see enum ProcFlagsHit - uint32 AttributesMask; // bitmask, see EnchantProcAttributes + SpellEnchantProcEntry() : Chance(0.f), ProcsPerMinute(0.f), HitMask(0), AttributesMask(0.f) { } + + float Chance; // if nonzero - overwrite SpellItemEnchantment value + float ProcsPerMinute; // if nonzero - chance to proc is equal to value * aura caster's weapon speed / 60 + uint32 HitMask; // if nonzero - bitmask for matching proc condition based on hit result, see enum ProcFlagsHit + uint32 AttributesMask; // bitmask, see EnchantProcAttributes }; typedef std::unordered_map SpellEnchantProcEventMap; @@ -343,9 +345,11 @@ typedef std::unordered_map> struct SpellThreatEntry { - int32 flatMod; // flat threat-value for this Spell - default: 0 - float pctMod; // threat-multiplier for this Spell - default: 1.0f - float apPctMod; // Pct of AP that is added as Threat - default: 0.0f + SpellThreatEntry() : flatMod(0), pctMod(1.f), apPctMod(0.f) { } + + int32 flatMod; // flat threat-value for this Spell - default: 0 + float pctMod; // threat-multiplier for this Spell - default: 1.0f + float apPctMod; // Pct of AP that is added as Threat - default: 0.0f }; typedef std::unordered_map SpellThreatMap; @@ -353,6 +357,8 @@ typedef std::unordered_map SpellThreatMap; // coordinates for spells (accessed using SpellMgr functions) struct SpellTargetPosition { + SpellTargetPosition() : target_mapId(0), target_X(0.f), target_Y(0.f), target_Z(0.f), target_Orientation(0.f) { } + uint32 target_mapId; float target_X; float target_Y; @@ -509,6 +515,8 @@ typedef std::pair SpellLearnSkillMap; struct SpellLearnSpellNode { + SpellLearnSpellNode() : spell(0), active(false), autoLearned(false) { } + uint32 spell; bool active; // show in spellbook or not bool autoLearned; @@ -557,7 +569,9 @@ typedef std::map SpellDifficultySearcherMap; struct PetDefaultSpellsEntry { - uint32 spellid[MAX_CREATURE_SPELL_DATA_SLOT]; + PetDefaultSpellsEntry() : spellid({ }) { } + + std::array spellid; }; // < 0 for petspelldata id, > 0 for creature_id