aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorsilver1ce <none@none>2010-01-18 21:51:45 +0200
committersilver1ce <none@none>2010-01-18 21:51:45 +0200
commitcfca61b176f1e262e71fa3ba2372ddd631d36c58 (patch)
tree3d948de297d9268adadfc49af40a0646bb04cb28 /src/game/Unit.cpp
parentf920a3c57b716712a4eaf2530aae8b6005dc3cfb (diff)
Auras with turn/move interrupt flags are now removed for creatures when they turn/move, cleanup
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 232438ebf40..2d2db26ef89 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -15902,7 +15902,7 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
// FIXME: this interrupts spell visual
DestroyForNearbyPlayers();
- GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
+ SetPosition(x, y, z, orientation, true);
//ObjectAccessor::UpdateObjectVisibility(this);
//WorldPacket data;
@@ -15913,6 +15913,40 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
}
}
+bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
+{
+ // prevent crash when a bad coord is sent by the client
+ if (!Trinity::IsValidMapCoord(x,y))
+ {
+ sLog.outDebug("Unit::SetPosition(%f, %f, %f) .. bad coordinates!",x,y,z);
+ return false;
+ }
+
+ bool turn = (GetOrientation() != orientation);
+ bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
+
+ if (turn)
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
+
+ if (relocated)
+ {
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
+
+ // move and update visible state if need
+ if(GetTypeId() == TYPEID_PLAYER)
+ GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
+ else
+ GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
+ }
+ else if(turn)
+ SetOrientation(orientation);
+
+ if ((relocated || turn) && IsVehicle())
+ GetVehicleKit()->RelocatePassengers(x,y,z,orientation);
+
+ return true;
+}
+
void Unit::SendThreatListUpdate()
{
if (uint32 count = getThreatManager().getThreatList().size())