diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-06 03:35:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-06 03:41:41 +0300 |
commit | 7ba416812eff7e24e93e9a3918299d4386b4a89a (patch) | |
tree | 24285fe83c6072c86faac034f2cd6977a6a14d1b /src/localplayer.cpp | |
parent | 36eeb46446039147b64a4552242002beaaec680d (diff) | |
download | mv-7ba416812eff7e24e93e9a3918299d4386b4a89a.tar.gz mv-7ba416812eff7e24e93e9a3918299d4386b4a89a.tar.bz2 mv-7ba416812eff7e24e93e9a3918299d4386b4a89a.tar.xz mv-7ba416812eff7e24e93e9a3918299d4386b4a89a.zip |
Fix player moving with mouse.
Now move with mouse is soft moving. Player always can stop or change direction.
Collisions not stoping player what holding down left mouse button.
Also fix typo in method name navigateClean.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f43d7e2d5..0ab1ca713 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2771,7 +2771,7 @@ void LocalPlayer::moveByDirection(unsigned char dir) void LocalPlayer::specialMove(unsigned char direction) { if (direction && (mNavigateX || mNavigateY)) - naviageClean(); + navigateClean(); if (direction && (getInvertDirection() >= 2 && getInvertDirection() <= 4) @@ -2922,7 +2922,7 @@ void LocalPlayer::setMap(Map *map) if (socialWindow) socialWindow->updateActiveList(); } - naviageClean(); + navigateClean(); mCrossX = 0; mCrossY = 0; @@ -3128,7 +3128,7 @@ void LocalPlayer::changeAwayMode() chatWindow->clearAwayLog(); cancelFollow(); - naviageClean(); + navigateClean(); if (outfitWindow) outfitWindow->wearAwayOutfit(); mAwayDialog = new OkDialog(_("Away"), @@ -3187,14 +3187,14 @@ void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick) } } -void LocalPlayer::navigateTo(int x, int y) +bool LocalPlayer::navigateTo(int x, int y) { if (!mMap) - return; + return false; SpecialLayer *tmpLayer = mMap->getTempLayer(); if (!tmpLayer) - return; + return false; const Vector &playerPos = getPosition(); mShowNavigePath = true; @@ -3213,6 +3213,7 @@ void LocalPlayer::navigateTo(int x, int y) if (mDrawPath) tmpLayer->addRoad(mNavigatePath); + return !mNavigatePath.empty(); } void LocalPlayer::navigateTo(Being *being) @@ -3243,7 +3244,7 @@ void LocalPlayer::navigateTo(Being *being) tmpLayer->addRoad(mNavigatePath); } -void LocalPlayer::naviageClean() +void LocalPlayer::navigateClean() { if (!mMap) return; @@ -3309,14 +3310,14 @@ void LocalPlayer::updateCoords() { if (!actorSpriteManager) { - naviageClean(); + navigateClean(); return; } Being* being = actorSpriteManager->findBeing(mNavigateId); if (!being) { - naviageClean(); + navigateClean(); return; } mNavigateX = being->getTileX(); @@ -3325,7 +3326,7 @@ void LocalPlayer::updateCoords() if (mNavigateX == x && mNavigateY == y) { - naviageClean(); + navigateClean(); return; } else @@ -3733,7 +3734,7 @@ void LocalPlayer::fixAttackTarget() void LocalPlayer::respawn() { - naviageClean(); + navigateClean(); } int LocalPlayer::getTargetTime() |