diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-18 22:13:37 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-18 22:13:37 +0200 |
commit | f4792bc06f21335fc2d1171d937ea7645ca0c253 (patch) | |
tree | c7b11cf81f254f5b9ed2f5dbfe127649abc7545a /src/being.cpp | |
parent | f98d003e354a1792117b7cbc771d1dd91475a156 (diff) | |
download | mv-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.gz mv-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.bz2 mv-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.xz mv-f4792bc06f21335fc2d1171d937ea7645ca0c253.zip |
Fix most conversions except manaserv net code and some other code.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/being.cpp b/src/being.cpp index 8604f0053..5ea0fca29 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -993,7 +993,7 @@ void Being::setDirection(Uint8 direction) Uint8 Being::calcDirection() const { - int dir = 0; + Uint8 dir = 0; if (mDest.x > mX) dir |= RIGHT; else if (mDest.x < mX) @@ -1007,7 +1007,7 @@ Uint8 Being::calcDirection() const Uint8 Being::calcDirection(int dstX, int dstY) const { - int dir = 0; + Uint8 dir = 0; if (dstX > mX) dir |= RIGHT; else if (dstX < mX) @@ -1162,8 +1162,9 @@ void Being::logic() case MOVE: { - if (getWalkSpeed().x && static_cast<int> ((get_elapsed_time( - mActionTime) * frameCount) / getWalkSpeed().x) + if (getWalkSpeed().x && static_cast<int> ((static_cast<float>( + get_elapsed_time(mActionTime)) * static_cast<float>( + frameCount)) / static_cast<float>(getWalkSpeed().x)) >= frameCount) { nextTile(); @@ -1249,8 +1250,9 @@ void Being::logic() if (!isAlive() && getWalkSpeed().x && Net::getGameHandler()->removeDeadBeings() - && static_cast<int> ((get_elapsed_time(mActionTime) - / getWalkSpeed().x) >= static_cast<float>(frameCount))) + && static_cast<int> ((static_cast<float>(get_elapsed_time(mActionTime)) + / static_cast<float>(getWalkSpeed().x))) + >= static_cast<int>(frameCount)) { if (getType() != PLAYER && actorSpriteManager) actorSpriteManager->destroy(this); @@ -1866,7 +1868,7 @@ void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage, if (p <= 0 || p > width) return; - int dx = width / p; + int dx = static_cast<int>(static_cast<float>(width) / p); graphics->setColor(userPalette->getColorWithAlpha(color1)); @@ -1908,7 +1910,7 @@ void Being::resetCounters() void Being::recalcSpritesOrder() { // logger->log("recalcSpritesOrder"); - unsigned sz = size(); + unsigned sz = static_cast<unsigned>(size()); if (sz < 1) return; |