diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-05 18:59:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-05 18:59:53 +0300 |
commit | b19a1c6d50c2c0f4233972f20c9354efca5ccb66 (patch) | |
tree | 34e2c6c432e732fa75226c1195ecc229bd3a7711 /src/being/being.cpp | |
parent | 1c34872aea8d196708aec8277017b467d01d09b0 (diff) | |
download | manaverse-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.gz manaverse-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.bz2 manaverse-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.xz manaverse-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.zip |
Change calculated speed in being from float to int.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index fadf254a9..2e1302fb7 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1704,15 +1704,15 @@ void Being::nextTile() restrict2 return; } - mActionTime += CAST_S32(mSpeed / 10); + mActionTime += mSpeed / 10; if ((mType != ActorType::Player || mUseDiagonal) && mX != pos.x && mY != pos.y) { - mSpeed = static_cast<float>(mWalkSpeed) * 1.4F; + mSpeed = mWalkSpeed * 14 / 10; } else { - mSpeed = static_cast<float>(mWalkSpeed); + mSpeed = mWalkSpeed; } if (mX != pos.x || mY != pos.y) @@ -1783,11 +1783,8 @@ void Being::logic() restrict2 case BeingAction::MOVE: { - if (static_cast<float>(get_elapsed_time( - mActionTime)) >= mSpeed) - { + if (get_elapsed_time(mActionTime) >= mSpeed) nextTile(); - } break; } @@ -1855,9 +1852,10 @@ void Being::logic() restrict2 if (frameCount < 10) frameCount = 10; - if (!isAlive() && mSpeed && gameHandler->removeDeadBeings() - && CAST_S32 ((static_cast<float>(get_elapsed_time(mActionTime)) - / mSpeed)) >= frameCount) + if (!isAlive() && + mSpeed && + gameHandler->removeDeadBeings() && + get_elapsed_time(mActionTime) / mSpeed >= frameCount) { if (mType != ActorType::Player && actorManager) actorManager->destroy(this); @@ -2172,10 +2170,8 @@ int Being::getOffset(const signed char pos, const int time = get_elapsed_time(mActionTime); offset = (pos == BeingDirection::LEFT && neg == BeingDirection::RIGHT) ? - CAST_S32((static_cast<float>(time) - * static_cast<float>(mMap->getTileWidth())) / mSpeed) : - CAST_S32((static_cast<float>(time) - * static_cast<float>(mMap->getTileHeight())) / mSpeed); + (time * mMap->getTileWidth() / mSpeed) : + (time * mMap->getTileHeight() / mSpeed); } // We calculate the offset _from_ the _target_ location |