From f98d003e354a1792117b7cbc771d1dd91475a156 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Mar 2011 17:48:29 +0200 Subject: Fix most old style cast except manaserv and libxml2 defines. --- src/localplayer.cpp | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'src/localplayer.cpp') 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(playerPos.x - 16) / 32, + static_cast(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(playerPos.x - 16) / 32, + static_cast(playerPos.y - 32) / 32, + being->getTileX(), being->getTileY(), 0x00, maxCost); being->setDistance(static_cast(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(playerPos.x - 16) / 32, + static_cast(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(playerPos.x - 16) / 32, + static_cast(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(playerPos.x - 16) / 32; + int y = static_cast(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(playerPos.x - 16) / 32, + static_cast(playerPos.y - 32) / 32, + being->getTileX(), being->getTileY(), + 0x00, 0); return static_cast(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(playerPos.x - 16) / 32, + static_cast(playerPos.y - 32) / 32, + mTarget->getTileX(), mTarget->getTileY(), + 0x00, 0); + if (!debugPath.empty()) { Path::const_iterator i = debugPath.begin(); -- cgit v1.2.3-60-g2f50