From 1c34872aea8d196708aec8277017b467d01d09b0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 5 Mar 2016 18:33:57 +0300 Subject: Replace in Being speed field from vector to int. --- src/being/being.cpp | 13 ++++++------- src/being/being.h | 8 ++++---- src/being/localplayer.cpp | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 49fb6a480..fadf254a9 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -186,9 +186,8 @@ Being::Being(const BeingId id, mIsGM(false), mType(type), mSpeechBubble(nullptr), - mWalkSpeed(playerHandler ? playerHandler->getDefaultWalkSpeed() - : Vector(1, 1, 1)), - mSpeed(playerHandler ? playerHandler->getDefaultWalkSpeed().x : 0), + mWalkSpeed(playerHandler ? playerHandler->getDefaultWalkSpeed() : 1), + mSpeed(playerHandler ? playerHandler->getDefaultWalkSpeed() : 0), mIp(), mSpriteRemap(new int[20]), mSpriteHide(new int[20]), @@ -465,11 +464,11 @@ void Being::setSubtype(const BeingTypeId subtype, if (playerHandler) setWalkSpeed(playerHandler->getDefaultWalkSpeed()); else - setWalkSpeed(Vector(1, 1, 0)); + setWalkSpeed(1); } else { - setWalkSpeed(Vector(speed, speed, 0)); + setWalkSpeed(speed); } } } @@ -1709,11 +1708,11 @@ void Being::nextTile() restrict2 if ((mType != ActorType::Player || mUseDiagonal) && mX != pos.x && mY != pos.y) { - mSpeed = static_cast(mWalkSpeed.x * 1.4F); + mSpeed = static_cast(mWalkSpeed) * 1.4F; } else { - mSpeed = mWalkSpeed.x; + mSpeed = static_cast(mWalkSpeed); } if (mX != pos.x || mY != pos.y) diff --git a/src/being/being.h b/src/being/being.h index 1fd7aa0ba..c9bb2eca7 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -404,13 +404,13 @@ class Being notfinal : public ActorSprite, /** * Sets the walk speed in pixels per second. */ - void setWalkSpeed(const Vector &restrict speed) restrict2 - { mWalkSpeed = speed; mSpeed = speed.x; } + void setWalkSpeed(const int speed) restrict2 + { mWalkSpeed = speed; mSpeed = static_cast(speed); } /** * Gets the walk speed in pixels per second. */ - Vector getWalkSpeed() const restrict2 noexcept A_WARN_UNUSED + int getWalkSpeed() const restrict2 noexcept A_WARN_UNUSED { return mWalkSpeed; } /** @@ -1096,7 +1096,7 @@ class Being notfinal : public ActorSprite, * In pixels per second. * @see MILLISECONDS_IN_A_TICK */ - Vector mWalkSpeed; + int mWalkSpeed; float mSpeed; std::string mIp; int *restrict mSpriteRemap A_NONNULLPOINTER; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index ecc3b20e4..47735875c 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -190,7 +190,7 @@ LocalPlayer::LocalPlayer(const BeingId id, mNameColor = nullptr; PlayerInfo::setStatBase(Attributes::WALK_SPEED, - CAST_S32(getWalkSpeed().x)); + getWalkSpeed()); PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0); loadHomes(); -- cgit v1.2.3-70-g09d2