From 2eaea4fba97eb4c4209210009dd07ff6d35d63a5 Mon Sep 17 00:00:00 2001 From: bdebaere Date: Thu, 29 Jun 2017 01:22:20 +0200 Subject: [PATCH] Add IsSeatedState() to handle AURA_INTERRUPT_FLAG_NOT_SEATED. * Update Unit.cpp Add IsSeatedState() to handle AURA_INTERRUPT_FLAG_NOT_SEATED. * Update Unit.h Add IsSeatedState() to handle AURA_INTERRUPT_FLAG_NOT_SEATED. * Update Unit.cpp Pointer reference --- src/game/Object/Unit.cpp | 10 ++++++++-- src/game/Object/Unit.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 9a46b40d..2713f400 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -8801,12 +8801,18 @@ bool Unit::IsStandState() const return !IsSitState() && s != UNIT_STAND_STATE_SLEEP && s != UNIT_STAND_STATE_KNEEL; } +bool Unit::IsSeatedState() const +{ + uint8 standState = getStandState(); + return standState != UNIT_STAND_STATE_SLEEP && standState != UNIT_STAND_STATE_STAND; +} + void Unit::SetStandState(uint8 state) { SetByteValue(UNIT_FIELD_BYTES_1, 0, state); - if (IsStandState()) - { RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED); } + if (!IsSeatedState()) + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED); if (GetTypeId() == TYPEID_PLAYER) { diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index f42c3ccf..110a3184 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -1785,6 +1785,8 @@ class Unit : public WorldObject * @return true if the Unit is standing normally, false otherwise */ bool IsStandState() const; + + bool IsSeatedState() const; /** * Change the stand state for this Unit. For possible values check * UnitStandStateType.