Skip to content

Commit

Permalink
Fix unit target variable confusion in spell code.
Browse files Browse the repository at this point in the history
unitTarget is a member of the spell class, it was mistaken for a local variable.
  • Loading branch information
ratkosrb committed Oct 17, 2023
1 parent 6187d45 commit c891e37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
z = waterLevel;
}

if (!MapManager::IsValidMapCoord(unitTarget->GetMapId(), x, y, z))
if (!MapManager::IsValidMapCoord(pUnitTarget->GetMapId(), x, y, z))
break;

pUnitTarget->GetMap()->GetLosHitPosition(srcX, srcY, srcZ, x, y, z, -0.5f);
Expand Down Expand Up @@ -6478,11 +6478,11 @@ SpellCastResult Spell::CheckCast(bool strict)
if (strict)
{
SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
Unit* unitTarget = m_targets.getUnitTarget();
if (unitTarget && spellRange && spellRange->maxRange > 0.0f)
Unit* pUnitTarget = m_targets.getUnitTarget();
if (pUnitTarget && spellRange && spellRange->maxRange > 0.0f)
{
float x, y, z;
unitTarget->GetPosition(x, y, z);
pUnitTarget->GetPosition(x, y, z);

if (!m_casterUnit->IsInWater())
{
Expand Down

0 comments on commit c891e37

Please sign in to comment.