diff options
author | silver1ce <none@none> | 2010-01-18 21:51:45 +0200 |
---|---|---|
committer | silver1ce <none@none> | 2010-01-18 21:51:45 +0200 |
commit | cfca61b176f1e262e71fa3ba2372ddd631d36c58 (patch) | |
tree | 3d948de297d9268adadfc49af40a0646bb04cb28 /src/game/Unit.cpp | |
parent | f920a3c57b716712a4eaf2530aae8b6005dc3cfb (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.cpp | 36 |
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()) |