diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-31 18:29:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-31 18:29:46 +0300 |
commit | eac30a76badf24f580d8f9d525ee305568e68363 (patch) | |
tree | 30c63d304d5b83beed4529167531ba560a4d6465 /src/gui/viewport.cpp | |
parent | 6262c897a5dcbc95e534a54af99186ee7efb541d (diff) | |
download | manaverse-eac30a76badf24f580d8f9d525ee305568e68363.tar.gz manaverse-eac30a76badf24f580d8f9d525ee305568e68363.tar.bz2 manaverse-eac30a76badf24f580d8f9d525ee305568e68363.tar.xz manaverse-eac30a76badf24f580d8f9d525ee305568e68363.zip |
Fix move issue with mouse.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 5c50836f6..f55385029 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -426,6 +426,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) mPlayerFollowMouse = false; if (mHoverBeing) { + validateSpeed(); if (actorSpriteManager) { std::vector<ActorSprite*> beings; @@ -447,11 +448,13 @@ void Viewport::mousePressed(gcn::MouseEvent &event) } else if (mHoverItem) { + validateSpeed(); mPopupMenu->showPopup(event.getX(), event.getY(), mHoverItem); return; } else if (mHoverSign) { + validateSpeed(); mPopupMenu->showPopup(event.getX(), event.getY(), mHoverSign); return; } @@ -483,6 +486,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (mHoverBeing->canTalk()) { + validateSpeed(); mHoverBeing->talkTo(); return; } @@ -490,6 +494,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) { if (mHoverBeing->getType() == ActorSprite::PLAYER) { + validateSpeed(); if (actorSpriteManager) { if (player_node != mHoverBeing || mSelfMouseHeal) @@ -502,6 +507,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) else if (player_node->withinAttackRange(mHoverBeing) || keyboard.isActionActive(keyboard.KEY_ATTACK)) { + validateSpeed(); if (player_node != mHoverBeing) { player_node->attack(mHoverBeing, @@ -511,6 +517,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) } else if (!keyboard.isActionActive(keyboard.KEY_ATTACK)) { + validateSpeed(); if (player_node != mHoverBeing) { player_node->setGotoTarget(mHoverBeing); @@ -522,11 +529,13 @@ void Viewport::mousePressed(gcn::MouseEvent &event) // Picks up a item if we clicked on one if (mHoverItem) { + validateSpeed(); player_node->pickUp(mHoverItem); } // Just walk around else if (!keyboard.isActionActive(keyboard.KEY_ATTACK)) { + validateSpeed(); player_node->stopAttack(); player_node->cancelFollow(); mPlayerFollowMouse = true; @@ -538,6 +547,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) else if (event.getButton() == gcn::MouseEvent::MIDDLE) { mPlayerFollowMouse = false; + validateSpeed(); // Find the being nearest to the clicked position if (actorSpriteManager) { @@ -924,3 +934,13 @@ void Viewport::returnCamera() mCameraRelativeX = 0; mCameraRelativeY = 0; } + +void Viewport::validateSpeed() +{ + if (!keyboard.isActionActive(keyboard.KEY_TARGET_ATTACK) + && !keyboard.isActionActive(keyboard.KEY_ATTACK)) + { + if (Game::instance()) + Game::instance()->setValidSpeed(); + } +} |