aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2017-04-27 14:55:06 +0200
committerccrs <ccrs@users.noreply.github.com>2017-04-27 14:55:06 +0200
commitc7a57e2a093ada2ece7a01eac2f627aeb26b08d5 (patch)
tree25eb3c91f547e6e34504f6b6393ea011b91b1bae /src/server/game/Entities/Unit
parent4431a1149da7bc48ad1047fc8c6135ed02b2e77b (diff)
Core/Unit: 2170541a51 followup
use true as default value since pretty much all the script calls will expect that
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp9
-rw-r--r--src/server/game/Entities/Unit/Unit.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f5026a8c799..9f8b3900144 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -2090,7 +2090,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
- SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
+ SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell cast at main hand attack only - no normal melee dmg dealt
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
@@ -2138,7 +2138,7 @@ void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BA
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
- SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
+ SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
CalcDamageInfo damageInfo;
damageInfo.attacker = this;
@@ -14189,7 +14189,8 @@ void Unit::SetInFront(WorldObject const* target)
void Unit::SetFacingTo(float ori, bool force)
{
- if (!force && !IsStopped())
+ // do not face when already moving
+ if (!force && (!IsStopped() || !movespline->Finalized()))
return;
Movement::MoveSplineInit init(this);
@@ -14203,7 +14204,7 @@ void Unit::SetFacingTo(float ori, bool force)
void Unit::SetFacingToObject(WorldObject const* object, bool force)
{
// do not face when already moving
- if (!force && !IsStopped())
+ if (!force && (!IsStopped() || !movespline->Finalized()))
return;
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 32788df4569..9267c18d4d2 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1649,8 +1649,8 @@ class TC_GAME_API Unit : public WorldObject
virtual bool SetHover(bool enable, bool packetOnly = false);
void SetInFront(WorldObject const* target);
- void SetFacingTo(float ori, bool force = false);
- void SetFacingToObject(WorldObject const* object, bool force = false);
+ void SetFacingTo(float const ori, bool force = true);
+ void SetFacingToObject(WorldObject const* object, bool force = true);
void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference);
void SendClearThreatListOpcode();