summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-15 00:34:34 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-15 00:56:17 +0200
commit847c623239f00a71038a1b8e3ef242c3d97f2272 (patch)
treef73583154ca410c83c1c02d2e4b11549f81914e0 /src
parente8bc0d9fd1be148f111f2c560e563e0552fc9f50 (diff)
downloadmv-847c623239f00a71038a1b8e3ef242c3d97f2272.tar.gz
mv-847c623239f00a71038a1b8e3ef242c3d97f2272.tar.bz2
mv-847c623239f00a71038a1b8e3ef242c3d97f2272.tar.xz
mv-847c623239f00a71038a1b8e3ef242c3d97f2272.zip
Fix mouse pickup. Before pickuptarget was removed while moving to target.
Diffstat (limited to 'src')
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/localplayer.cpp16
2 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 4039dc87b..92bd0d80b 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -510,6 +510,7 @@ void Viewport::mouseDragged(gcn::MouseEvent &event)
if (get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay)
{
mLocalWalkTime = tick_time;
+ player_node->unSetPickUpTarget();
player_node->setDestination(event.getX()
+ static_cast<int>(mPixelViewX),
event.getY()
@@ -528,6 +529,7 @@ void Viewport::mouseDragged(gcn::MouseEvent &event)
int destY = static_cast<int>((static_cast<float>(event.getY())
+ mPixelViewY)
/ static_cast<float>(mMap->getTileHeight()));
+ player_node->unSetPickUpTarget();
player_node->setDestination(destX, destY);
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 4cb944439..e69703e06 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -789,6 +789,11 @@ void LocalPlayer::nextTile(unsigned char dir = 0)
if (mWalkingDir)
startWalking(mWalkingDir);
}
+ else if (mPath.size() == 1)
+ {
+ if (mPickUpTarget)
+ pickUp(mPickUpTarget);
+ }
// TODO: Fix automatically walking within range of target, when wanted
if (mGoingToTarget && mTarget && withinAttackRange(mTarget))
@@ -805,7 +810,6 @@ void LocalPlayer::nextTile(unsigned char dir = 0)
mPath.clear();
}
-
Being::nextTile();
}
else
@@ -972,7 +976,6 @@ void LocalPlayer::setDestination(int x, int y)
{
mActivityTime = cur_time;
- mPickUpTarget = NULL;
if (getAttackType() == 0 || !mAttackMoving)
mKeepAttacking = false;
@@ -1072,6 +1075,7 @@ void LocalPlayer::startWalking(unsigned char dir)
if (!mMap || !dir)
return;
+ mPickUpTarget = 0;
if (mAction == MOVE && !mPath.empty())
{
// Just finish the current action, otherwise we get out of sync
@@ -1142,6 +1146,7 @@ void LocalPlayer::stopWalking(bool sendToServer)
{
mWalkingDir = 0;
mLocalWalkTime = 0;
+ mPickUpTarget = 0;
setDestination(static_cast<int>(getPosition().x),
static_cast<int>(getPosition().y));
@@ -1434,6 +1439,7 @@ void LocalPlayer::setGotoTarget(Being *target)
if (!target)
return;
+ mPickUpTarget = 0;
if (Net::getNetworkType() == ServerInfo::MANASERV)
{
mTarget = target;
@@ -1610,6 +1616,7 @@ void LocalPlayer::moveTo(int x, int y)
void LocalPlayer::move(int dX, int dY)
{
+ mPickUpTarget = 0;
moveTo(getTileX() + dX, getTileY() + dY);
}
@@ -1705,6 +1712,7 @@ void LocalPlayer::moveToTarget(unsigned int dist)
void LocalPlayer::moveToHome()
{
+ mPickUpTarget = 0;
if ((getTileX() != mCrossX || getTileY() != mCrossY) && mCrossX && mCrossY)
{
moveTo(mCrossX, mCrossY);
@@ -3488,7 +3496,10 @@ void LocalPlayer::imitateOutfit(Being *player, int sprite)
void LocalPlayer::followMoveTo(Being *being, int x, int y)
{
if (!mPlayerFollowed.empty() && being->getName() == mPlayerFollowed)
+ {
+ mPickUpTarget = 0;
setDestination(x, y);
+ }
}
void LocalPlayer::followMoveTo(Being *being, int x1, int y1, int x2, int y2)
@@ -3496,6 +3507,7 @@ void LocalPlayer::followMoveTo(Being *being, int x1, int y1, int x2, int y2)
if (!being)
return;
+ mPickUpTarget = 0;
if (!mPlayerFollowed.empty() && being->getName() == mPlayerFollowed)
{
switch (mFollowMode)