summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-11 01:45:43 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-11 01:45:43 +0300
commitfdfe2900f11958b7851f6c57a15ad0dc80334a11 (patch)
tree59ef90c2aa72d4939bc978194680b7498b4815fa
parent3e68cc3b6a3e45c2c552b7cae6b34557bed96dbc (diff)
downloadplus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.gz
plus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.bz2
plus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.tar.xz
plus-fdfe2900f11958b7851f6c57a15ad0dc80334a11.zip
Do not allow select pet by mouse click on it.
-rw-r--r--src/gui/viewport.cpp40
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;
+ }
}
}
}