mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 22:56:24 +00:00
refactor(Core): NULL -> nullptr (#3275)
* NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -177,8 +177,8 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
|
||||
SpellGroupStackFlags sFlag = sSpellMgr->GetGroupStackFlags(groupId);
|
||||
if (!aurEff->IsPeriodic() && (sFlag & SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE))
|
||||
{
|
||||
AuraApplication* strongestApp = apply ? this : NULL;
|
||||
AuraEffect* strongestEff = apply ? aurEff : NULL;
|
||||
AuraApplication* strongestApp = apply ? this : nullptr;
|
||||
AuraEffect* strongestEff = apply ? aurEff : nullptr;
|
||||
int32 amount = apply ? abs(aurEff->GetAmount()) : 0;
|
||||
Unit* target = GetTarget();
|
||||
Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType(aurEff->GetAuraType());
|
||||
@@ -322,13 +322,13 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas
|
||||
*refresh = false;
|
||||
uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
|
||||
if (!effMask)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, periodicReset))
|
||||
{
|
||||
// we've here aura, which script triggered removal after modding stack amount
|
||||
// check the state here, so we won't create new Aura object
|
||||
if (foundAura->IsRemoved())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (refresh)
|
||||
*refresh = true;
|
||||
@@ -346,7 +346,7 @@ Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject
|
||||
ASSERT(tryEffMask <= MAX_EFFECT_MASK);
|
||||
uint8 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
|
||||
if (!effMask)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
|
||||
}
|
||||
|
||||
@@ -373,9 +373,9 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
||||
if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
|
||||
// owner not in world so don't allow to own not self casted single target auras
|
||||
if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Aura* aura = NULL;
|
||||
Aura* aura = nullptr;
|
||||
switch (owner->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
@@ -387,17 +387,17 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
||||
break;
|
||||
default:
|
||||
ABORT();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// aura can be removed in Unit::_AddAura call
|
||||
if (aura->IsRemoved())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return aura;
|
||||
}
|
||||
|
||||
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) :
|
||||
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(NULL)),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(nullptr)),
|
||||
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
|
||||
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
|
||||
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
|
||||
@@ -418,7 +418,7 @@ AuraScript* Aura::GetScriptByName(std::string const& scriptName) const
|
||||
for (std::list<AuraScript*>::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
|
||||
if ((*itr)->_GetScriptName()->compare(scriptName) == 0)
|
||||
return *itr;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount)
|
||||
@@ -429,7 +429,7 @@ void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount)
|
||||
if (effMask & (uint8(1) << i))
|
||||
m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster);
|
||||
else
|
||||
m_effects[i] = NULL;
|
||||
m_effects[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp
|
||||
{
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent())
|
||||
{
|
||||
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
|
||||
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : nullptr;
|
||||
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true);
|
||||
}
|
||||
}
|
||||
@@ -728,8 +728,8 @@ void Aura::UpdateOwner(uint32 diff, WorldObject* owner)
|
||||
Unit* caster = GetCaster();
|
||||
// Apply spellmods for channeled auras
|
||||
// used for example when triggered spell of spell:10 is modded
|
||||
Spell* modSpell = NULL;
|
||||
Player* modOwner = NULL;
|
||||
Spell* modSpell = nullptr;
|
||||
Player* modOwner = nullptr;
|
||||
if (caster)
|
||||
{
|
||||
modOwner = caster->GetSpellModOwner();
|
||||
@@ -808,7 +808,7 @@ void Aura::Update(uint32 diff, Unit* caster)
|
||||
|
||||
int32 Aura::CalcMaxDuration(Unit* caster) const
|
||||
{
|
||||
Player* modOwner = NULL;
|
||||
Player* modOwner = nullptr;
|
||||
int32 maxDuration;
|
||||
|
||||
if (caster)
|
||||
@@ -1252,7 +1252,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
if (*itr < 0)
|
||||
target->RemoveAurasDueToSpell(-(*itr));
|
||||
else if (removeMode != AURA_REMOVE_BY_DEATH)
|
||||
target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID());
|
||||
target->CastSpell(target, *itr, true, nullptr, nullptr, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
|
||||
@@ -1382,7 +1382,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
|
||||
|
||||
int32 basepoints0 = damage;
|
||||
caster->CastCustomSpell(target, 64801, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(target, 64801, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1400,8 +1400,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
|
||||
int32 heal = int32(CalculatePct(basepoints0, 15));
|
||||
|
||||
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(target, 63675, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(caster, 75999, &heal, nullptr, nullptr, true, NULL, GetEffect(0));
|
||||
}
|
||||
}
|
||||
// Power Word: Shield
|
||||
@@ -1412,7 +1412,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
{
|
||||
// instantly heal m_amount% of the absorb-value
|
||||
int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100;
|
||||
caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, NULL, NULL, true, 0, GetEffect(0));
|
||||
caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, 0, GetEffect(0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1433,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
if (GetCasterGUID() == target->GetGUID())
|
||||
break;
|
||||
|
||||
AuraEffect* aurEff = NULL;
|
||||
AuraEffect* aurEff = nullptr;
|
||||
// Ebon Plaguebringer / Crypt Fever
|
||||
Unit::AuraEffectList const& TalentAuras = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
for (Unit::AuraEffectList::const_iterator itr = TalentAuras.begin(); itr != TalentAuras.end(); ++itr)
|
||||
@@ -1589,7 +1589,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1))
|
||||
{
|
||||
int32 basepoints0 = aurEff->GetAmount() * caster->GetCreateMana() / 100;
|
||||
caster->CastCustomSpell(caster, 64103, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(caster, 64103, &basepoints0, nullptr, nullptr, true, NULL, GetEffect(0));
|
||||
}
|
||||
}
|
||||
// Power word: shield
|
||||
@@ -1622,7 +1622,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
multiplier += 0.5f;
|
||||
|
||||
int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
|
||||
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
|
||||
caster->CastCustomSpell(caster, 47755, &basepoints0, nullptr, nullptr, true);
|
||||
}
|
||||
// effect on aura target
|
||||
if (AuraEffect const* aurEff = aura->GetEffect(1))
|
||||
@@ -1636,7 +1636,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
case POWER_MANA:
|
||||
{
|
||||
int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
|
||||
caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true);
|
||||
caster->CastCustomSpell(target, 63654, &basepoints0, nullptr, nullptr, true);
|
||||
break;
|
||||
}
|
||||
case POWER_RAGE: triggeredSpellId = 63653; break;
|
||||
@@ -1837,7 +1837,7 @@ bool Aura::IsAuraStronger(Aura const* newAura) const
|
||||
if (!thisEffect)
|
||||
continue;
|
||||
|
||||
AuraEffect* newEffect = NULL;
|
||||
AuraEffect* newEffect = nullptr;
|
||||
for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
newEffect = newAura->GetEffect(j);
|
||||
@@ -1988,7 +1988,7 @@ bool Aura::CanStackWith(Aura const* existingAura, bool remove) const
|
||||
|
||||
if (VehicleAura1 && VehicleAura2)
|
||||
{
|
||||
Vehicle* veh = NULL;
|
||||
Vehicle* veh = nullptr;
|
||||
if (GetOwner()->ToUnit())
|
||||
veh = GetOwner()->ToUnit()->GetVehicleKit();
|
||||
|
||||
@@ -2027,7 +2027,7 @@ bool Aura::IsProcOnCooldown() const
|
||||
{
|
||||
/*if (m_procCooldown)
|
||||
{
|
||||
if (m_procCooldown > time(NULL))
|
||||
if (m_procCooldown > time(nullptr))
|
||||
return true;
|
||||
}*/
|
||||
return false;
|
||||
@@ -2035,7 +2035,7 @@ bool Aura::IsProcOnCooldown() const
|
||||
|
||||
void Aura::AddProcCooldown(uint32 /*msec*/)
|
||||
{
|
||||
//m_procCooldown = time(NULL) + msec;
|
||||
//m_procCooldown = time(nullptr) + msec;
|
||||
}
|
||||
|
||||
void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo)
|
||||
@@ -2111,7 +2111,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
|
||||
if (eventInfo.GetDamageInfo())
|
||||
{
|
||||
WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType();
|
||||
Item* item = NULL;
|
||||
Item* item = nullptr;
|
||||
if (attType == BASE_ATTACK)
|
||||
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
else if (attType == OFF_ATTACK)
|
||||
|
||||
Reference in New Issue
Block a user