From fdfe2900f11958b7851f6c57a15ad0dc80334a11 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Mar 2014 01:45:43 +0300 Subject: Do not allow select pet by mouse click on it. --- src/gui/viewport.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'src') 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( - 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( + Input::KEY_ATTACK))) { - player_node->attack(mHoverBeing, - !inputManager.isActionActive( - static_cast(Input::KEY_STOP_ATTACK))); - return true; + validateSpeed(); + if (player_node != mHoverBeing) + { + player_node->attack(mHoverBeing, + !inputManager.isActionActive( + static_cast(Input::KEY_STOP_ATTACK))); + return true; + } } - } - else if (!inputManager.isActionActive(static_cast( - Input::KEY_ATTACK))) - { - validateSpeed(); - if (player_node != mHoverBeing) + else if (!inputManager.isActionActive(static_cast( + Input::KEY_ATTACK))) { - player_node->setGotoTarget(mHoverBeing); - return true; + validateSpeed(); + if (player_node != mHoverBeing) + { + player_node->setGotoTarget(mHoverBeing); + return true; + } } } } -- cgit v1.2.3-70-g09d2