summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/setup_players.cpp3
-rw-r--r--src/gui/viewport.cpp18
-rw-r--r--src/gui/viewport.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 16f4620d4..7c0d8148c 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -216,6 +216,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "disableBeingCaching", false);
AddDEF(configData, "enableReorderSprites", true);
AddDEF(configData, "showip", false);
+ AddDEF(configData, "seflMouseHeal", true);
return configData;
}
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 78c77f6f1..670fc3635 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -78,6 +78,9 @@ Setup_Players::Setup_Players()
new SetupItemCheckBox(_("Show ip addresses on screenshots"), "",
"showip", this, "showipEvent");
+ new SetupItemCheckBox(_("Allow self heal with mouse click"), "",
+ "selfMouseHeal", this, "selfMouseHealEvent");
+
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
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
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index d6ee54834..50c81aff4 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -285,6 +285,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
int mScrollRadius;
int mScrollLaziness;
bool mShowBeingPopup;
+ bool mSelfMouseHeal;
int mScrollCenterOffsetX;
int mScrollCenterOffsetY;
int mMouseX; /**< Current mouse position in pixels. */