aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r--src/game/SpellEffects.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index c55001a2d84..eec4fd837bf 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2493,14 +2493,15 @@ void Spell::EffectTeleportUnits(uint32 i)
// Init dest coordinates
uint32 mapid = m_targets.m_dstPos.GetMapId();
- if(mapid == MAPID_INVALID)
+ if (mapid == MAPID_INVALID)
mapid = unitTarget->GetMapId();
- float x, y, z;
- m_targets.m_dstPos.GetPosition(x, y, z);
- float orientation = m_targets.getUnitTarget() ? m_targets.getUnitTarget()->GetOrientation() : unitTarget->GetOrientation();
- sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f\n", mapid, x, y, z);
+ float x, y, z, orientation;
+ m_targets.m_dstPos.GetPosition(x, y, z, orientation);
+ if (!orientation && m_targets.getUnitTarget())
+ orientation = m_targets.getUnitTarget()->GetOrientation();
+ sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation);
- if(mapid == unitTarget->GetMapId())
+ if (mapid == unitTarget->GetMapId())
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);