diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2018-01-17 02:17:49 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2018-01-17 02:17:49 -0300 |
| commit | b64c5043140dc7b7908e259e441de16cc0261320 (patch) | |
| tree | cd3ec7447df76abde2bf4b7ddb9cf591aeffd5f1 /src/server/game/Spells/SpellMgr.cpp | |
| parent | 72ff2e30c30d4d1b9bf22695b6a097eb82e3c76a (diff) | |
Core/Globals: throw some RAII into ObjectMgr, and load templates into vectors
Ref #14274
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 731d4f4dfb7..ca05c9c8b02 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2269,24 +2269,23 @@ void SpellMgr::LoadPetDefaultSpells() uint32 countCreature = 0; uint32 countData = 0; - CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); - for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) + CreatureTemplateContainer const& ctc = sObjectMgr->GetCreatureTemplates(); + for (auto const& creatureTemplate : ctc) { - - if (!itr->second.PetSpellDataId) + if (!creatureTemplate || !creatureTemplate->PetSpellDataId) continue; // for creature with PetSpellDataId get default pet spells from dbc - CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(itr->second.PetSpellDataId); + CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(creatureTemplate->PetSpellDataId); if (!spellDataEntry) continue; - int32 petSpellsId = -int32(itr->second.PetSpellDataId); + int32 petSpellsId = -int32(creatureTemplate->PetSpellDataId); PetDefaultSpellsEntry petDefSpells; for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) petDefSpells.spellid[j] = spellDataEntry->spellId[j]; - if (LoadPetDefaultSpells_helper(&itr->second, petDefSpells)) + if (LoadPetDefaultSpells_helper(creatureTemplate.get(), petDefSpells)) { mPetDefaultSpellsMap[petSpellsId] = petDefSpells; ++countData; |
