Core/Unit: For convenience, explicitly redirect CastSpell with nullptr as first argument to the Unit* overloads. No more ->CastSpell((Unit*)nullptr, ...) all over the place!

(cherry picked from commits c7896f3102 and 40c78cac4c)
This commit is contained in:
Treeston
2017-07-21 17:56:55 +02:00
parent 2628daadeb
commit 2a08556273
5 changed files with 10 additions and 8 deletions

View File

@@ -1233,7 +1233,9 @@ class TC_GAME_API Unit : public WorldObject
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(std::nullptr_t, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty) { CastSpell((Unit*)nullptr, spellId, triggered, castItem, triggeredByAura, originalCaster); }
void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(std::nullptr_t, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty) { CastSpell((Unit*)nullptr, spellId, triggerFlags, castItem, triggeredByAura, originalCaster); }
void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty);

View File

@@ -124,7 +124,7 @@ class VoidSpawnSummon : public BasicEvent
bool Execute(uint64 /*time*/, uint32 /*diff*/)
{
_owner->CastSpell((Unit*)nullptr, SPELL_SUMMON_VOID_SENTINEL, true);
_owner->CastSpell(nullptr, SPELL_SUMMON_VOID_SENTINEL, true);
return true;
}
@@ -589,7 +589,7 @@ class spell_summon_blood_elves_script : SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
for (uint8 i = 0; i < MAX_SUMMON_BLOOD_ELVES; ++i)
GetCaster()->CastSpell((Unit*)nullptr, SummonBloodElvesSpells[urand(0,3)], true);
GetCaster()->CastSpell(nullptr, SummonBloodElvesSpells[urand(0,3)], true);
}
void Register() override
@@ -621,7 +621,7 @@ class spell_muru_darkness : SpellScriptLoader
void HandleAfterCast()
{
for (uint8 i = 0; i < MAX_SUMMON_DARK_FIEND; ++i)
GetCaster()->CastSpell((Unit*)nullptr, SummonDarkFiendSpells[i], true);
GetCaster()->CastSpell(nullptr, SummonDarkFiendSpells[i], true);
}
void Register() override
@@ -683,7 +683,7 @@ class spell_transform_visual_missile_periodic : public SpellScriptLoader
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
GetTarget()->CastSpell((Unit*)nullptr, RAND(TRANSFORM_VISUAL_MISSILE_1, TRANSFORM_VISUAL_MISSILE_2), true);
GetTarget()->CastSpell(nullptr, RAND(TRANSFORM_VISUAL_MISSILE_1, TRANSFORM_VISUAL_MISSILE_2), true);
}
void Register() override
@@ -709,7 +709,7 @@ class spell_summon_blood_elves_periodic : public SpellScriptLoader
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
GetTarget()->CastSpell((Unit*)nullptr, SPELL_SUMMON_BLOOD_ELVES_SCRIPT, true);
GetTarget()->CastSpell(nullptr, SPELL_SUMMON_BLOOD_ELVES_SCRIPT, true);
}
void Register() override

View File

@@ -245,7 +245,7 @@ class npc_corrupted_soul_fragment : public CreatureScript
if (instance->GetGuidData(DATA_BRONJAHM).GetCounter() != id)
return;
me->CastSpell((Unit*)nullptr, SPELL_CONSUME_SOUL, true);
me->CastSpell(nullptr, SPELL_CONSUME_SOUL, true);
me->DespawnOrUnsummon();
}

View File

@@ -320,7 +320,7 @@ class instance_gundrak : public InstanceMapScript
if (GameObject* altar = GetGameObject(altarId))
if (Creature* trigger = altar->FindNearestCreature(NPC_ALTAR_TRIGGER, 10.0f))
trigger->CastSpell((Unit*)nullptr, spellId, true);
trigger->CastSpell(nullptr, spellId, true);
// eventId equals statueId
ToggleGameObject(eventId, GO_STATE_READY);

View File

@@ -865,7 +865,7 @@ class spell_summon_gauntlet_mobs_periodic : public SpellScriptLoader
for (uint8 i = 0; i < 2; ++i)
{
uint32 spellId = SummonSpellsList.front();
GetTarget()->CastSpell((Unit*)nullptr, spellId, true);
GetTarget()->CastSpell(nullptr, spellId, true);
SummonSpellsList.push_back(spellId);
SummonSpellsList.pop_front();
}