From 97bcfab999c6e689e394333e13b6e7bed65eff3e Mon Sep 17 00:00:00 2001 From: Olion Date: Fri, 21 Jul 2017 20:41:44 +0300 Subject: [PATCH] Change return value of a getting spell target method from Unit* to ObjectGuid --- src/game/WorldHandlers/Spell.cpp | 8 ++++---- src/game/WorldHandlers/Spell.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index dab488b0..f0871558 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -4080,13 +4080,13 @@ void Spell::CastPreCastSpells(Unit* target) { m_caster->CastSpell(target, (*si), true, m_CastItem); } } -Unit* Spell::GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex effIndex) const +ObjectGuid Spell::GetPrefilledOrUnitTargetGuid(SpellEffectIndex effIndex) const { for (TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) if (itr->effectMask & (1 << effIndex)) - { return m_caster->GetMap()->GetUnit(itr->targetGUID); } + { return itr->targetGUID; } - return m_targets.getUnitTarget(); + return m_targets.getUnitTargetGuid(); } SpellCastResult Spell::CheckCast(bool strict) @@ -5147,7 +5147,7 @@ SpellCastResult Spell::CheckCast(bool strict) { continue; } // Possible Unit-target for the spell - Unit* expectedTarget = GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex(i)); + Unit* expectedTarget = m_caster->GetMap() ? m_caster->GetMap()->GetUnit(GetPrefilledOrUnitTargetGuid(SpellEffectIndex(i))) : NULL; switch (m_spellInfo->EffectApplyAuraName[i]) { diff --git a/src/game/WorldHandlers/Spell.h b/src/game/WorldHandlers/Spell.h index a3e53283..d573306a 100644 --- a/src/game/WorldHandlers/Spell.h +++ b/src/game/WorldHandlers/Spell.h @@ -520,8 +520,8 @@ class Spell void FillAreaTargets(UnitList& targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = NULL); void FillRaidOrPartyTargets(UnitList& targetUnitMap, Unit* member, float radius, bool raid, bool withPets, bool withcaster); - // Returns a target that was filled by SPELL_SCRIPT_TARGET (or selected victim) Can return NULL - Unit* GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex effIndex) const; + // Returns GUID either of the 1st target from the implicit target list, or of explicit one (selected victim) + ObjectGuid GetPrefilledOrUnitTargetGuid(SpellEffectIndex effIndex) const; void GetSpellRangeAndRadius(SpellEffectIndex effIndex, float& radius, uint32& EffectChainTarget, uint32& unMaxTargets) const; //*****************************************