diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-19 01:04:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-19 01:04:45 +0300 |
commit | eaa6f58f960f2ef5826de4fd2ea6ff0e383fac8b (patch) | |
tree | 3d388de830571423cfc06784dc709d46a99d6dd5 /src/gui/viewport.cpp | |
parent | dea21e405d0cda6c21e2a25841ec0db2f3ace34a (diff) | |
download | manaplus-eaa6f58f960f2ef5826de4fd2ea6ff0e383fac8b.tar.gz manaplus-eaa6f58f960f2ef5826de4fd2ea6ff0e383fac8b.tar.bz2 manaplus-eaa6f58f960f2ef5826de4fd2ea6ff0e383fac8b.tar.xz manaplus-eaa6f58f960f2ef5826de4fd2ea6ff0e383fac8b.zip |
Allow pickup item with mouse under player.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index aedfbe219..1407415fd 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -481,6 +481,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (mHoverBeing->canTalk()) { mHoverBeing->talkTo(); + return; } else { @@ -490,6 +491,9 @@ void Viewport::mousePressed(gcn::MouseEvent &event) { if (player_node != mHoverBeing || mSelfMouseHeal) actorSpriteManager->heal(mHoverBeing); + if (player_node == mHoverBeing && mHoverItem) + player_node->pickUp(mHoverItem); + return; } } else if (player_node->withinAttackRange(mHoverBeing) || @@ -499,17 +503,21 @@ void Viewport::mousePressed(gcn::MouseEvent &event) { player_node->attack(mHoverBeing, !keyboard.isKeyActive(keyboard.KEY_TARGET)); + return; } } else if (!keyboard.isKeyActive(keyboard.KEY_ATTACK)) { if (player_node != mHoverBeing) + { player_node->setGotoTarget(mHoverBeing); + return; + } } } - // Picks up a item if we clicked on one } - else if (mHoverItem) + // Picks up a item if we clicked on one + if (mHoverItem) { player_node->pickUp(mHoverItem); } @@ -739,7 +747,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED) } mHoverItem = nullptr; - if (!mHoverBeing && actorSpriteManager) + if (actorSpriteManager) { mHoverItem = actorSpriteManager->findItem(x / mMap->getTileWidth(), y / mMap->getTileHeight()); |