diff options
| author | n0n4m3 <none@none> | 2009-12-19 17:48:45 +0100 |
|---|---|---|
| committer | n0n4m3 <none@none> | 2009-12-19 17:48:45 +0100 |
| commit | 57bdbdc0ca8e867520de9927389edb703a04c43a (patch) | |
| tree | 4b34244abdbdb7f142bedbaf5ed77a46c75189de /src | |
| parent | 2925dfcfc45b836cd6608192c17c8227f6f8fffa (diff) | |
Add function to update orientation of unit (for both server andclient). by NoFantasy
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Level3.cpp | 16 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 11 | ||||
| -rw-r--r-- | src/game/Unit.h | 1 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 0fec45ec35a..dada1862338 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6623,13 +6623,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args) bool triggered = (trig_str != NULL); - // update orientation at server - caster->SetOrientation(caster->GetAngle(m_session->GetPlayer())); - - // and client - WorldPacket data; - caster->BuildHeartBeatMsg(&data); - caster->SendMessageToSet(&data,true); + caster->SetFacingToObject(m_session->GetPlayer()); caster->CastSpell(m_session->GetPlayer(),spell,triggered); @@ -6714,13 +6708,7 @@ bool ChatHandler::HandleCastTargetCommand(const char *args) bool triggered = (trig_str != NULL); - // update orientation at server - caster->SetOrientation(caster->GetAngle(m_session->GetPlayer())); - - // and client - WorldPacket data; - caster->BuildHeartBeatMsg(&data); - caster->SendMessageToSet(&data,true); + caster->SetFacingToObject(m_session->GetPlayer()); caster->CastSpell(caster->getVictim(),spell,triggered); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 117c64d61de..e0cda1b56a9 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3517,6 +3517,17 @@ bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); } +void Unit::SetFacingToObject(WorldObject* pObject) +{ + // update orientation at server + SetOrientation(GetAngle(pObject)); + + // and client + WorldPacket data; + BuildHeartBeatMsg(&data); + SendMessageToSet(&data, false); +} + bool Unit::isInAccessiblePlaceFor(Creature const* c) const { if(IsInWater()) diff --git a/src/game/Unit.h b/src/game/Unit.h index b439cf35dc6..84a526f2cfb 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1624,6 +1624,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject SetOrientation(GetAngle(target)); } bool isInBackInMap(Unit const* target, float distance, float arc = M_PI) const; + void SetFacingToObject(WorldObject* pObject); // Visibility system UnitVisibility GetVisibility() const { return m_Visibility; } |
