From a366d82dad85389c9562fdfdd3a981894603fa07 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 12 Jul 2017 19:54:41 +0300 Subject: Move group id from localplayer to being. --- src/being/being.cpp | 1 + src/being/being.h | 7 +++++++ src/being/localplayer.cpp | 3 +-- src/being/localplayer.h | 7 +------ 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index b281919f3..ff8593c11 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -189,6 +189,7 @@ Being::Being(const BeingId id, mSpeechTime(0), mAttackSpeed(350), mLevel(0), + mGroupId(0), mAttackRange(1), mLastAttackX(0), mLastAttackY(0), diff --git a/src/being/being.h b/src/being/being.h index 3d21311b7..8bba7548d 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1070,6 +1070,12 @@ class Being notfinal : public ActorSprite, uint16_t getTeamId() const restrict2 noexcept2 A_WARN_UNUSED { return mTeamId; } + virtual void setGroupId(const int id) + { mGroupId = id; } + + int getGroupId() const noexcept2 A_WARN_UNUSED + { return mGroupId; } + void serverRemove() restrict2 noexcept2; void addCast(const int dstX, @@ -1193,6 +1199,7 @@ class Being notfinal : public ActorSprite, int mAttackSpeed; /**< Attack speed */ int mLevel; + int mGroupId; int mAttackRange; int mLastAttackX; int mLastAttackY; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index a5b5ce5fc..68d39f08f 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -117,7 +117,6 @@ LocalPlayer::LocalPlayer(const BeingId id, AttributeListener(), PlayerDeathListener(), StatListener(), - mGroupId(0), mMoveState(0), mLastTargetX(0), mLastTargetY(0), @@ -418,7 +417,7 @@ void LocalPlayer::setAction(const BeingActionT &action, void LocalPlayer::setGroupId(const int id) { - mGroupId = id; + Being::setGroupId(id); if (id > 0) { diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 7e77f5322..76a8c913b 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -114,10 +114,7 @@ class LocalPlayer final : public Being, void attack2(Being *const target = nullptr, const bool keep = false, const bool dontChangeEquipment = false); - void setGroupId(const int id); - - int getGroupId() const noexcept2 A_WARN_UNUSED - { return mGroupId; } + void setGroupId(const int id) override final; void stopAttack(const bool keepAttack = false); @@ -454,8 +451,6 @@ class LocalPlayer final : public Being, void loadHomes(); - int mGroupId; - // move state. used if mMoveType == 2 unsigned int mMoveState; -- cgit v1.2.3-60-g2f50