diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:48:29 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:49:00 +0200 |
commit | f98d003e354a1792117b7cbc771d1dd91475a156 (patch) | |
tree | dc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/localplayer.cpp | |
parent | bb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff) | |
download | plus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz plus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2 plus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz plus-f98d003e354a1792117b7cbc771d1dd91475a156.zip |
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index e69703e06..d544b8ed7 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2534,9 +2534,9 @@ bool LocalPlayer::isReachable(int x, int y, int maxCost) const Vector &playerPos = getPosition(); Path debugPath = mMap->findPath( - (int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - x, y, 0x00, maxCost); + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + x, y, 0x00, maxCost); return !debugPath.empty(); } @@ -2562,9 +2562,9 @@ bool LocalPlayer::isReachable(Being *being, int maxCost) const Vector &playerPos = getPosition(); Path debugPath = mMap->findPath( - (int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - being->getTileX(), being->getTileY(), 0x00, maxCost); + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + being->getTileX(), being->getTileY(), 0x00, maxCost); being->setDistance(static_cast<int>(debugPath.size())); if (!debugPath.empty()) @@ -3134,9 +3134,10 @@ void LocalPlayer::navigateTo(int x, int y) mNavigateY = y; mNavigateId = 0; - mNavigatePath = mMap->findPath((int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - x, y, 0x00, 0); + mNavigatePath = mMap->findPath( + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + x, y, 0x00, 0); if (mDrawPath) tmpLayer->addRoad(mNavigatePath); @@ -3160,10 +3161,11 @@ void LocalPlayer::navigateTo(Being *being) mNavigateX = being->getTileX(); mNavigateY = being->getTileY(); - mNavigatePath = mMap->findPath((int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - being->getTileX(), being->getTileY(), - 0x00, 0); + mNavigatePath = mMap->findPath( + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + being->getTileX(), being->getTileY(), + 0x00, 0); if (mDrawPath) tmpLayer->addRoad(mNavigatePath); @@ -3215,8 +3217,8 @@ void LocalPlayer::updateCoords() if (!tmpLayer) return; - int x = (int) (playerPos.x - 16) / 32; - int y = (int) (playerPos.y - 32) / 32; + int x = static_cast<int>(playerPos.x - 16) / 32; + int y = static_cast<int>(playerPos.y - 32) / 32; if (mNavigateId) { if (!actorSpriteManager) @@ -3291,10 +3293,11 @@ int LocalPlayer::getPathLength(Being* being) const Vector &playerPos = getPosition(); - Path debugPath = mMap->findPath((int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - being->getTileX(), being->getTileY(), - 0x00, 0); + Path debugPath = mMap->findPath( + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + being->getTileX(), being->getTileY(), + 0x00, 0); return static_cast<int>(debugPath.size()); } @@ -3629,10 +3632,12 @@ void LocalPlayer::fixAttackTarget() return; const Vector &playerPos = getPosition(); - Path debugPath = mMap->findPath((int) (playerPos.x - 16) / 32, - (int) (playerPos.y - 32) / 32, - mTarget->getTileX(), mTarget->getTileY(), - 0x00, 0); + Path debugPath = mMap->findPath( + static_cast<int>(playerPos.x - 16) / 32, + static_cast<int>(playerPos.y - 32) / 32, + mTarget->getTileX(), mTarget->getTileY(), + 0x00, 0); + if (!debugPath.empty()) { Path::const_iterator i = debugPath.begin(); |