diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-05 18:33:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-05 18:33:57 +0300 |
commit | 1c34872aea8d196708aec8277017b467d01d09b0 (patch) | |
tree | dd14d98c40666797d1c5c14f39a5f117d17d791c | |
parent | 3fae3f59aad1f1f2eee1e1bfa088672787bc9c78 (diff) | |
download | manaverse-1c34872aea8d196708aec8277017b467d01d09b0.tar.gz manaverse-1c34872aea8d196708aec8277017b467d01d09b0.tar.bz2 manaverse-1c34872aea8d196708aec8277017b467d01d09b0.tar.xz manaverse-1c34872aea8d196708aec8277017b467d01d09b0.zip |
Replace in Being speed field from vector to int.
-rw-r--r-- | src/being/being.cpp | 13 | ||||
-rw-r--r-- | src/being/being.h | 8 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/beingrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 9 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 6 | ||||
-rw-r--r-- | src/net/eathena/charserverrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 10 |
10 files changed, 26 insertions, 30 deletions
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<float>(mWalkSpeed.x * 1.4F); + mSpeed = static_cast<float>(mWalkSpeed) * 1.4F; } else { - mSpeed = mWalkSpeed.x; + mSpeed = static_cast<float>(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<float>(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(); diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index 21e79a089..364236a08 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -458,7 +458,7 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg) return; } const int16_t speed = msg.readInt16("speed"); - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); int16_t x = msg.readInt16("x"); int16_t y = msg.readInt16("y"); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 65466ba5e..d6464028e 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -59,11 +59,9 @@ void PlayerHandler::ignoreAll(const bool ignore A_UNUSED) const { } -Vector PlayerHandler::getDefaultWalkSpeed() const +int PlayerHandler::getDefaultWalkSpeed() const { - // Return an normalized speed for any side - // as the offset is calculated elsewhere. - return Vector(150, 150, 0); + return 150; } bool PlayerHandler::canUseMagic() const @@ -85,8 +83,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, switch (type) { case Ea::WALK_SPEED: - localPlayer->setWalkSpeed(Vector(static_cast<float>( - base), static_cast<float>(base), 0)); + localPlayer->setWalkSpeed(base); PlayerInfo::setStatBase(Attributes::WALK_SPEED, base); PlayerInfo::setStatMod(Attributes::WALK_SPEED, 0); break; diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 18e62a2da..e5105dc16 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -52,7 +52,7 @@ class PlayerHandler notfinal : public Net::PlayerHandler bool canUseMagic() const override final; - Vector getDefaultWalkSpeed() const override final A_WARN_UNUSED; + int getDefaultWalkSpeed() const override final A_WARN_UNUSED; void setStat(Net::MessageIn &msg, const int type, diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index b6e30d7fc..8e6293bbe 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -318,7 +318,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) if (speed == 0) speed = 150; - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -482,7 +482,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) if (speed == 0) speed = 150; - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -656,7 +656,7 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) if (speed == 0) speed = 150; - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index e82a8c144..452180d55 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -238,7 +238,7 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg) localPlayer = charServerHandler->mSelectedCharacter->dummy; PlayerInfo::setBackend(charServerHandler->mSelectedCharacter->data); PlayerInfo::setStatBase(Attributes::WALK_SPEED, - playerHandler->getDefaultWalkSpeed().x); + playerHandler->getDefaultWalkSpeed()); charServerHandler->mSelectedCharacter->dummy = nullptr; diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 2a0e2d391..19682bda4 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -73,7 +73,7 @@ class PlayerHandler notfinal virtual bool canUseMagic() const = 0; - virtual Vector getDefaultWalkSpeed() const A_WARN_UNUSED = 0; + virtual int getDefaultWalkSpeed() const A_WARN_UNUSED = 0; virtual void requestOnlineList() const = 0; diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index 0c077b900..1d8f16871 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -278,7 +278,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) dstBeing->setParty(party); } - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); @@ -414,7 +414,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) dstBeing->setParty(party); } - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); @@ -546,7 +546,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) dstBeing->setParty(party); } - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); @@ -744,7 +744,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) dstBeing->setSubtype(fromInt(job, BeingTypeId), look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t headBottom = msg.readInt16("head bottom"); @@ -945,7 +945,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) dstBeing->setSubtype(fromInt(job, BeingTypeId), look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); - dstBeing->setWalkSpeed(Vector(speed, speed, 0)); + dstBeing->setWalkSpeed(speed); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t headBottom = msg.readInt16("head bottom"); |