Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources

This commit is contained in:
ariel- committed 2018-03-28 04:41:59 -03:00
1 parent 7fff6c424f
commit 5ff847159c
1243 files changed
+29780 -36517

No files matched your search

+42 -53
View File
@@ -17,17 +17,21 @@
*/
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "Spell.h"
#include "ObjectMgr.h"
#include "SpellAuraDefines.h"
#include "SharedDefines.h"
#include "DBCStores.h"
#include "Chat.h"
#include "BattlegroundMgr.h"
#include "BattlefieldWG.h"
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "Log.h"
#include "Map.h"
#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "SharedDefines.h"
#include "Spell.h"
#include "SpellAuraDefines.h"
#include "SpellInfo.h"
#include <G3D/g3dmath.h>
bool IsPrimaryProfessionSkill(uint32 skill)
@@ -199,7 +203,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
{
TC_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2);
TC_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is nullptr, using mode %u", spellId, mode, mode - 2);
mode -= 2;
}
@@ -216,7 +220,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
SpellInfo const* SpellMgr::GetSpellForDifficultyFromSpell(SpellInfo const* spell, Unit const* caster) const
{
if (!spell)
return NULL;
return nullptr;
uint32 newSpellId = GetSpellIdForDifficulty(spell->Id, caster);
SpellInfo const* newSpell = GetSpellInfo(newSpellId);
@@ -234,7 +238,7 @@ SpellChainNode const* SpellMgr::GetSpellChainNode(uint32 spell_id) const
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
if (itr == mSpellChains.end())
return NULL;
return nullptr;
return &itr->second;
}
@@ -320,7 +324,7 @@ SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const
if (itr != mSpellLearnSkills.end())
return &itr->second;
else
return NULL;
return nullptr;
}
SpellLearnSpellMapBounds SpellMgr::GetSpellLearnSpellMapBounds(uint32 spell_id) const
@@ -347,7 +351,7 @@ SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, Spe
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(std::make_pair(spell_id, effIndex));
if (itr != mSpellTargetPositions.end())
return &itr->second;
return NULL;
return nullptr;
}
SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id) const
@@ -494,7 +498,7 @@ SpellProcEntry const* SpellMgr::GetSpellProcEntry(uint32 spellId) const
SpellProcMap::const_iterator itr = mSpellProcMap.find(spellId);
if (itr != mSpellProcMap.end())
return &itr->second;
return NULL;
return nullptr;
}
bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo)
@@ -592,7 +596,7 @@ SpellBonusEntry const* SpellMgr::GetSpellBonusData(uint32 spellId) const
if (itr2 != mSpellBonusMap.end())
return &itr2->second;
}
return NULL;
return nullptr;
}
SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const
@@ -607,7 +611,7 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const
if (itr != mSpellThreatMap.end())
return &itr->second;
}
return NULL;
return nullptr;
}
SkillLineAbilityMapBounds SpellMgr::GetSkillLineAbilityMapBounds(uint32 spell_id) const
@@ -621,7 +625,7 @@ PetAura const* SpellMgr::GetPetAura(uint32 spell_id, uint8 eff) const
if (itr != mSpellPetAuraMap.end())
return &itr->second;
else
return NULL;
return nullptr;
}
SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) const
@@ -629,7 +633,7 @@ SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) c
SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
if (itr != mSpellEnchantProcEventMap.end())
return &itr->second;
return NULL;
return nullptr;
}
bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const
@@ -640,7 +644,7 @@ bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const
const std::vector<int32>* SpellMgr::GetSpellLinked(int32 spell_id) const
{
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
return itr != mSpellLinkedMap.end() ? &(itr->second) : nullptr;
}
PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) const
@@ -649,7 +653,7 @@ PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) con
if (itr != mPetLevelupSpellMap.end())
return &itr->second;
else
return NULL;
return nullptr;
}
PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const
@@ -657,7 +661,7 @@ PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
if (itr != mPetDefaultSpellsMap.end())
return &itr->second;
return NULL;
return nullptr;
}
SpellAreaMapBounds SpellMgr::GetSpellAreaMapBounds(uint32 spell_id) const
@@ -783,7 +787,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
void SpellMgr::UnloadSpellInfoChains()
{
for (SpellChainMap::iterator itr = mSpellChains.begin(); itr != mSpellChains.end(); ++itr)
mSpellInfoMap[itr->first]->ChainEntry = NULL;
mSpellInfoMap[itr->first]->ChainEntry = nullptr;
mSpellChains.clear();
}
@@ -799,7 +803,7 @@ void SpellMgr::LoadSpellTalentRanks()
if (!talentInfo)
continue;
SpellInfo const* lastSpell = NULL;
SpellInfo const* lastSpell = nullptr;
for (uint8 rank = MAX_TALENT_RANK - 1; rank > 0; --rank)
{
if (talentInfo->RankID[rank])
@@ -819,7 +823,7 @@ void SpellMgr::LoadSpellTalentRanks()
continue;
}
SpellInfo const* prevSpell = NULL;
SpellInfo const* prevSpell = nullptr;
for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
{
uint32 spellId = talentInfo->RankID[rank];
@@ -839,7 +843,7 @@ void SpellMgr::LoadSpellTalentRanks()
node.rank = rank + 1;
node.prev = prevSpell;
node.next = node.rank < MAX_TALENT_RANK ? GetSpellInfo(talentInfo->RankID[node.rank]) : NULL;
node.next = node.rank < MAX_TALENT_RANK ? GetSpellInfo(talentInfo->RankID[node.rank]) : nullptr;
mSpellChains[spellId] = node;
mSpellInfoMap[spellId]->ChainEntry = &mSpellChains[spellId];
@@ -952,7 +956,7 @@ void SpellMgr::LoadSpellRanks()
if (itr == rankChain.end())
{
mSpellChains[addedSpell].next = NULL;
mSpellChains[addedSpell].next = nullptr;
break;
}
else
@@ -2302,7 +2306,7 @@ bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpells
return false;
// remove duplicates with levelupSpells if any
if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : NULL)
if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : nullptr)
{
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
@@ -2608,40 +2612,25 @@ void SpellMgr::LoadSpellAreas()
TC_LOG_INFO("server.loading", ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Temporary structure to hold spell effect entries for faster loading
struct SpellEffectArray
{
SpellEffectArray()
{
effects[0] = NULL;
effects[1] = NULL;
effects[2] = NULL;
}
SpellEffectEntry const* effects[MAX_SPELL_EFFECTS];
};
void SpellMgr::LoadSpellInfoStore()
{
uint32 oldMSTime = getMSTime();
UnloadSpellInfoStore();
mSpellInfoMap.resize(sSpellStore.GetNumRows(), NULL);
mSpellInfoMap.resize(sSpellStore.GetNumRows(), nullptr);
std::map<uint32, SpellEffectArray> effectsBySpell;
for (uint32 i = 0; i < sSpellEffectStore.GetNumRows(); ++i)
// Temporary structure to hold spell effect entries for faster loading
struct SpellEffectArray
{
SpellEffectEntry const* effect = sSpellEffectStore.LookupEntry(i);
if (!effect)
continue;
SpellEffectEntry const* effects[MAX_SPELL_EFFECTS] = { };
};
std::unordered_map<uint32, SpellEffectArray> effectsBySpell;
for (SpellEffectEntry const* effect : sSpellEffectStore)
effectsBySpell[effect->EffectSpellId].effects[effect->EffectIndex] = effect;
}
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(i))
mSpellInfoMap[i] = new SpellInfo(spellEntry, effectsBySpell[i].effects);
for (SpellEntry const* spellEntry : sSpellStore)
mSpellInfoMap[spellEntry->Id] = new SpellInfo(spellEntry, effectsBySpell[spellEntry->Id].effects);
for (uint32 spellIndex = 0; spellIndex < GetSpellInfoStoreSize(); ++spellIndex)
{
@@ -2681,7 +2670,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
{
uint32 oldMSTime = getMSTime();
uint32 oldMSTime2 = oldMSTime;
SpellInfo* spellInfo = NULL;
SpellInfo* spellInfo = nullptr;
QueryResult result = WorldDatabase.Query("SELECT entry, attributes FROM spell_custom_attr");