diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-11 01:45:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-11 01:45:43 +0300 |
commit | fdfe2900f11958b7851f6c57a15ad0dc80334a11 (patch) | |
tree | 59ef90c2aa72d4939bc978194680b7498b4815fa /src/gui | |
parent | 3e68cc3b6a3e45c2c552b7cae6b34557bed96dbc (diff) | |
download | manaplus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.gz manaplus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.bz2 manaplus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.xz manaplus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.zip |
Do not allow select pet by mouse click on it.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/viewport.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 00260f5f1..9b349c7f6 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -420,7 +420,8 @@ bool Viewport::leftMouseAction() } else { - if (mHoverBeing->getType() == ActorSprite::PLAYER) + const ActorSprite::Type type = mHoverBeing->getType(); + if (type == ActorSprite::PLAYER) { validateSpeed(); if (actorManager) @@ -432,27 +433,30 @@ bool Viewport::leftMouseAction() return true; } } - else if (player_node->withinAttackRange(mHoverBeing) || - inputManager.isActionActive(static_cast<int>( - Input::KEY_ATTACK))) + else if (type == ActorSprite::MONSTER || type == ActorSprite::NPC) { - validateSpeed(); - if (player_node != mHoverBeing) + if (player_node->withinAttackRange(mHoverBeing) || + inputManager.isActionActive(static_cast<int>( + Input::KEY_ATTACK))) { - player_node->attack(mHoverBeing, - !inputManager.isActionActive( - static_cast<int>(Input::KEY_STOP_ATTACK))); - return true; + validateSpeed(); + if (player_node != mHoverBeing) + { + player_node->attack(mHoverBeing, + !inputManager.isActionActive( + static_cast<int>(Input::KEY_STOP_ATTACK))); + return true; + } } - } - else if (!inputManager.isActionActive(static_cast<int>( - Input::KEY_ATTACK))) - { - validateSpeed(); - if (player_node != mHoverBeing) + else if (!inputManager.isActionActive(static_cast<int>( + Input::KEY_ATTACK))) { - player_node->setGotoTarget(mHoverBeing); - return true; + validateSpeed(); + if (player_node != mHoverBeing) + { + player_node->setGotoTarget(mHoverBeing); + return true; + } } } } |