summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-02 18:26:22 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-02 18:26:22 +0300
commitf117a2b94fcfd67d05652ab8a89cf8d7559b96a9 (patch)
treeed2027d407a7c5bbfe44ed4b18f854ac5f473b05 /src/gui/viewport.cpp
parentb17d7d87918b76323e08c0a5c09abd8fa1f3ed71 (diff)
downloadmv-f117a2b94fcfd67d05652ab8a89cf8d7559b96a9.tar.gz
mv-f117a2b94fcfd67d05652ab8a89cf8d7559b96a9.tar.bz2
mv-f117a2b94fcfd67d05652ab8a89cf8d7559b96a9.tar.xz
mv-f117a2b94fcfd67d05652ab8a89cf8d7559b96a9.zip
Add option to disable self heal with mouse click.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index b2e9d8d20..b6e09c011 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -79,10 +79,12 @@ Viewport::Viewport():
mScrollCenterOffsetX = config.getIntValue("ScrollCenterOffsetX");
mScrollCenterOffsetY = config.getIntValue("ScrollCenterOffsetY");
mShowBeingPopup = config.getBoolValue("showBeingPopup");
+ mSelfMouseHeal = config.getBoolValue("selfMouseHeal");
config.addListener("ScrollLaziness", this);
config.addListener("ScrollRadius", this);
config.addListener("showBeingPopup", this);
+ config.addListener("selfMouseHeal", this);
mPopupMenu = new PopupMenu;
mBeingPopup = new BeingPopup;
@@ -96,6 +98,7 @@ Viewport::~Viewport()
config.removeListener("ScrollLaziness", this);
config.removeListener("ScrollRadius", this);
config.removeListener("showBeingPopup", this);
+ config.removeListener("selfMouseHeal", this);
delete mPopupMenu;
mPopupMenu = 0;
@@ -473,17 +476,24 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
if (mHoverBeing->getType() == ActorSprite::PLAYER)
{
if (actorSpriteManager)
- actorSpriteManager->heal(player_node, mHoverBeing);
+ {
+ if (player_node != mHoverBeing || mSelfMouseHeal)
+ actorSpriteManager->heal(player_node, mHoverBeing);
+ }
}
else if (player_node->withinAttackRange(mHoverBeing) ||
keyboard.isKeyActive(keyboard.KEY_ATTACK))
{
- player_node->attack(mHoverBeing,
- !keyboard.isKeyActive(keyboard.KEY_TARGET));
+ if (player_node != mHoverBeing)
+ {
+ player_node->attack(mHoverBeing,
+ !keyboard.isKeyActive(keyboard.KEY_TARGET));
+ }
}
else if (!keyboard.isKeyActive(keyboard.KEY_ATTACK))
{
- player_node->setGotoTarget(mHoverBeing);
+ if (player_node != mHoverBeing)
+ player_node->setGotoTarget(mHoverBeing);
}
}
// Picks up a item if we clicked on one