Change return value of a getting spell target method from Unit* to ObjectGuid

This commit is contained in:
Olion 2017-07-21 20:41:44 +03:00 committed by Antz
parent 758c562994
commit 97bcfab999
2 changed files with 6 additions and 6 deletions

View File

@ -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])
{

View File

@ -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;
//*****************************************