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

+64 -62
View File
@@ -15,19 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SpellAuras.h"
#include "SpellInfo.h"
#include "Battleground.h"
#include "Corpse.h"
#include "Creature.h"
#include "DBCStores.h"
#include "InstanceScript.h"
#include "Item.h"
#include "ItemTemplate.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
#include "Spell.h"
#include "SpellAuraDefines.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "Spell.h"
#include "DBCStores.h"
#include "ConditionMgr.h"
#include "Player.h"
#include "Battleground.h"
#include "Vehicle.h"
#include "Pet.h"
#include "InstanceScript.h"
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
@@ -362,13 +366,13 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* /*spellEntry*/, SpellInfo con
Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0);
TargetA = SpellImplicitTargetInfo(_effect ? _effect->EffectImplicitTargetA : 0);
TargetB = SpellImplicitTargetInfo(_effect ? _effect->EffectImplicitTargetB : 0);
RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : NULL;
MaxRadiusEntry = _effect && _effect->EffectRadiusMaxIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusMaxIndex) : NULL;
RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : nullptr;
MaxRadiusEntry = _effect && _effect->EffectRadiusMaxIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusMaxIndex) : nullptr;
ChainTarget = _effect ? _effect->EffectChainTarget : 0;
ItemType = _effect ? _effect->EffectItemType : 0;
TriggerSpell = _effect ? _effect->EffectTriggerSpell : 0;
SpellClassMask = _effect ? _effect->EffectSpellClassMask : flag96(0);
ImplicitTargetConditions = NULL;
ImplicitTargetConditions = nullptr;
ScalingMultiplier = scaling ? scaling->Multiplier[_effIndex] : 0.0f;
DeltaScalingMultiplier = scaling ? scaling->RandomMultiplier[_effIndex] : 0.0f;
ComboScalingMultiplier = scaling ? scaling->OtherMultiplier[_effIndex] : 0.0f;
@@ -591,27 +595,27 @@ int32 SpellEffectInfo::CalcBaseValue(int32 value) const
float SpellEffectInfo::CalcValueMultiplier(Unit* caster, Spell* spell) const
{
float multiplier = ValueMultiplier;
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
modOwner->ApplySpellMod<SPELLMOD_VALUE_MULTIPLIER>(_spellInfo->Id, multiplier, spell);
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell);
return multiplier;
}
float SpellEffectInfo::CalcDamageMultiplier(Unit* caster, Spell* spell) const
{
float multiplierPercent = DamageMultiplier * 100.0f;
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
modOwner->ApplySpellMod<SPELLMOD_DAMAGE_MULTIPLIER>(_spellInfo->Id, multiplierPercent, spell);
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplierPercent, spell);
return multiplierPercent / 100.0f;
}
bool SpellEffectInfo::HasRadius() const
{
return RadiusEntry != NULL;
return RadiusEntry != nullptr;
}
bool SpellEffectInfo::HasMaxRadius() const
{
return MaxRadiusEntry != NULL;
return MaxRadiusEntry != nullptr;
}
float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
@@ -629,7 +633,7 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
radius += entry->RadiusPerLevel * caster->getLevel();
radius = std::min(radius, entry->RadiusMax);
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_RADIUS>(_spellInfo->Id, radius, spell);
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
}
return radius;
@@ -877,10 +881,10 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
AttributesEx9 = spellEntry->AttributesEx9;
AttributesEx10 = spellEntry->AttributesEx10;
AttributesCu = 0;
CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : NULL;
DurationEntry = spellEntry->DurationIndex ? sSpellDurationStore.LookupEntry(spellEntry->DurationIndex) : NULL;
CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : nullptr;
DurationEntry = spellEntry->DurationIndex ? sSpellDurationStore.LookupEntry(spellEntry->DurationIndex) : nullptr;
PowerType = spellEntry->powerType;
RangeEntry = spellEntry->rangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->rangeIndex) : NULL;
RangeEntry = spellEntry->rangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->rangeIndex) : nullptr;
Speed = spellEntry->speed;
for (uint8 i = 0; i < 2; ++i)
@@ -949,7 +953,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
// SpellCategoriesEntry
SpellCategoriesEntry const* _categorie = GetSpellCategories();
CategoryEntry = _categorie ? sSpellCategoryStore.LookupEntry(_categorie->Category) : NULL;
CategoryEntry = _categorie ? sSpellCategoryStore.LookupEntry(_categorie->Category) : nullptr;
Dispel = _categorie ? _categorie->Dispel : 0;
Mechanic = _categorie ? _categorie->Mechanic : 0;
StartRecoveryCategory = _categorie ? _categorie->StartRecoveryCategory : 0;
@@ -1026,7 +1030,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
for (uint8 i = 0; i < 2; ++i)
Totem[i] = _totem ? _totem->Totem[i] : 0;
ChainEntry = NULL;
ChainEntry = nullptr;
ExplicitTargetMask = 0;
_spellSpecific = SPELL_SPECIFIC_NORMAL;
@@ -1586,7 +1590,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
return SPELL_CAST_OK;
bool actAsShifted = false;
SpellShapeshiftFormEntry const* shapeInfo = NULL;
SpellShapeshiftFormEntry const* shapeInfo = nullptr;
if (form > 0)
{
shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
@@ -1811,10 +1815,10 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (HasAttribute(SPELL_ATTR0_CU_PICKPOCKET))
{
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
return SPELL_FAILED_TARGET_NO_POCKETS;
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
return SPELL_FAILED_TARGET_NO_POCKETS;
}
// Not allow disarm unarmed player
@@ -1850,14 +1854,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
// corpseOwner and unit specific target checks
if (HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS) && unitTarget->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_TARGET_NOT_PLAYER;
return SPELL_FAILED_TARGET_NOT_PLAYER;
if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
return SPELL_FAILED_TARGETS_DEAD;
return SPELL_FAILED_TARGETS_DEAD;
// check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
if (implicit && HasAttribute(SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED) && !unitTarget->CanFreeMove())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_FAILED_BAD_TARGETS;
// checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
//if (!HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
@@ -1913,12 +1917,10 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW))
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
if (HasAttribute(SPELL_ATTR8_BATTLE_RESURRECTION))
if (Map* map = caster->GetMap())
if (InstanceMap* iMap = map->ToInstanceMap())
if (InstanceScript* instance = iMap->GetInstanceScript())
if (instance->GetCombatResurrectionCharges() == 0 && instance->IsEncounterInProgress())
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
if (HasAttribute(SPELL_ATTR8_BATTLE_RESURRECTION))
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetCombatResurrectionCharges() == 0 && instance->IsEncounterInProgress())
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
return SPELL_CAST_OK;
}
@@ -3197,7 +3199,7 @@ float SpellInfo::GetMaxRange(bool positive, Unit* caster, Spell* spell) const
range = RangeEntry->maxRangeHostile;
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_RANGE>(Id, range, spell);
modOwner->ApplySpellMod(Id, SPELLMOD_RANGE, range, spell);
return range;
}
@@ -3215,7 +3217,7 @@ int32 SpellInfo::GetMaxDuration() const
return (DurationEntry->Duration[2] == -1) ? -1 : abs(DurationEntry->Duration[2]);
}
uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= NULL*/) const
uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= nullptr*/) const
{
int32 castTime = 0;
if (!level && spell)
@@ -3363,7 +3365,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
// Apply cost mod by spell
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_COST>(Id, powerCost, spell);
modOwner->ApplySpellMod(Id, SPELLMOD_COST, powerCost, spell);
if (!caster->IsControlledByPlayer())
{
@@ -3393,7 +3395,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
bool SpellInfo::IsRanked() const
{
return ChainEntry != NULL;
return ChainEntry != nullptr;
}
uint8 SpellInfo::GetRank() const
@@ -3412,19 +3414,19 @@ SpellInfo const* SpellInfo::GetFirstRankSpell() const
SpellInfo const* SpellInfo::GetLastRankSpell() const
{
if (!ChainEntry)
return NULL;
return nullptr;
return ChainEntry->last;
}
SpellInfo const* SpellInfo::GetNextRankSpell() const
{
if (!ChainEntry)
return NULL;
return nullptr;
return ChainEntry->next;
}
SpellInfo const* SpellInfo::GetPrevRankSpell() const
{
if (!ChainEntry)
return NULL;
return nullptr;
return ChainEntry->prev;
}
@@ -3456,7 +3458,7 @@ SpellInfo const* SpellInfo::GetAuraRankForLevel(uint8 level) const
if (!needRankSelection)
return this;
for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != NULL; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != nullptr; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
{
// if found appropriate level
if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
@@ -3466,7 +3468,7 @@ SpellInfo const* SpellInfo::GetAuraRankForLevel(uint8 level) const
}
// not found
return NULL;
return nullptr;
}
bool SpellInfo::IsRankOf(SpellInfo const* spellInfo) const
@@ -3812,77 +3814,77 @@ bool SpellInfo::_IsPositiveTarget(uint32 targetA, uint32 targetB)
SpellTargetRestrictionsEntry const* SpellInfo::GetSpellTargetRestrictions() const
{
return SpellTargetRestrictionsId ? sSpellTargetRestrictionsStore.LookupEntry(SpellTargetRestrictionsId) : NULL;
return SpellTargetRestrictionsId ? sSpellTargetRestrictionsStore.LookupEntry(SpellTargetRestrictionsId) : nullptr;
}
SpellEquippedItemsEntry const* SpellInfo::GetSpellEquippedItems() const
{
return SpellEquippedItemsId ? sSpellEquippedItemsStore.LookupEntry(SpellEquippedItemsId) : NULL;
return SpellEquippedItemsId ? sSpellEquippedItemsStore.LookupEntry(SpellEquippedItemsId) : nullptr;
}
SpellInterruptsEntry const* SpellInfo::GetSpellInterrupts() const
{
return SpellInterruptsId ? sSpellInterruptsStore.LookupEntry(SpellInterruptsId) : NULL;
return SpellInterruptsId ? sSpellInterruptsStore.LookupEntry(SpellInterruptsId) : nullptr;
}
SpellLevelsEntry const* SpellInfo::GetSpellLevels() const
{
return SpellLevelsId ? sSpellLevelsStore.LookupEntry(SpellLevelsId) : NULL;
return SpellLevelsId ? sSpellLevelsStore.LookupEntry(SpellLevelsId) : nullptr;
}
SpellPowerEntry const* SpellInfo::GetSpellPower() const
{
return SpellPowerId ? sSpellPowerStore.LookupEntry(SpellPowerId) : NULL;
return SpellPowerId ? sSpellPowerStore.LookupEntry(SpellPowerId) : nullptr;
}
SpellReagentsEntry const* SpellInfo::GetSpellReagents() const
{
return SpellReagentsId ? sSpellReagentsStore.LookupEntry(SpellReagentsId) : NULL;
return SpellReagentsId ? sSpellReagentsStore.LookupEntry(SpellReagentsId) : nullptr;
}
SpellScalingEntry const* SpellInfo::GetSpellScaling() const
{
return SpellScalingId ? sSpellScalingStore.LookupEntry(SpellScalingId) : NULL;
return SpellScalingId ? sSpellScalingStore.LookupEntry(SpellScalingId) : nullptr;
}
SpellShapeshiftEntry const* SpellInfo::GetSpellShapeshift() const
{
return SpellShapeshiftId ? sSpellShapeshiftStore.LookupEntry(SpellShapeshiftId) : NULL;
return SpellShapeshiftId ? sSpellShapeshiftStore.LookupEntry(SpellShapeshiftId) : nullptr;
}
SpellTotemsEntry const* SpellInfo::GetSpellTotems() const
{
return SpellTotemsId ? sSpellTotemsStore.LookupEntry(SpellTotemsId) : NULL;
return SpellTotemsId ? sSpellTotemsStore.LookupEntry(SpellTotemsId) : nullptr;
}
SpellAuraOptionsEntry const* SpellInfo::GetSpellAuraOptions() const
{
return SpellAuraOptionsId ? sSpellAuraOptionsStore.LookupEntry(SpellAuraOptionsId) : NULL;
return SpellAuraOptionsId ? sSpellAuraOptionsStore.LookupEntry(SpellAuraOptionsId) : nullptr;
}
SpellAuraRestrictionsEntry const* SpellInfo::GetSpellAuraRestrictions() const
{
return SpellAuraRestrictionsId ? sSpellAuraRestrictionsStore.LookupEntry(SpellAuraRestrictionsId) : NULL;
return SpellAuraRestrictionsId ? sSpellAuraRestrictionsStore.LookupEntry(SpellAuraRestrictionsId) : nullptr;
}
SpellCastingRequirementsEntry const* SpellInfo::GetSpellCastingRequirements() const
{
return SpellCastingRequirementsId ? sSpellCastingRequirementsStore.LookupEntry(SpellCastingRequirementsId) : NULL;
return SpellCastingRequirementsId ? sSpellCastingRequirementsStore.LookupEntry(SpellCastingRequirementsId) : nullptr;
}
SpellCategoriesEntry const* SpellInfo::GetSpellCategories() const
{
return SpellCategoriesId ? sSpellCategoriesStore.LookupEntry(SpellCategoriesId) : NULL;
return SpellCategoriesId ? sSpellCategoriesStore.LookupEntry(SpellCategoriesId) : nullptr;
}
SpellClassOptionsEntry const* SpellInfo::GetSpellClassOptions() const
{
return SpellClassOptionsId ? sSpellClassOptionsStore.LookupEntry(SpellClassOptionsId) : NULL;
return SpellClassOptionsId ? sSpellClassOptionsStore.LookupEntry(SpellClassOptionsId) : nullptr;
}
SpellCooldownsEntry const* SpellInfo::GetSpellCooldowns() const
{
return SpellCooldownsId ? sSpellCooldownsStore.LookupEntry(SpellCooldownsId) : NULL;
return SpellCooldownsId ? sSpellCooldownsStore.LookupEntry(SpellCooldownsId) : nullptr;
}
void SpellInfo::_UnloadImplicitTargetConditionLists()
@@ -3896,7 +3898,7 @@ void SpellInfo::_UnloadImplicitTargetConditionLists()
for (uint8 j = i; j < MAX_SPELL_EFFECTS; ++j)
{
if (Effects[j].ImplicitTargetConditions == cur)
Effects[j].ImplicitTargetConditions = NULL;
Effects[j].ImplicitTargetConditions = nullptr;
}
delete cur;
}