summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-10 15:55:59 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-10 15:55:59 +0300
commitbfc5d7483c0a81409ebf08603f634e88b8db03f8 (patch)
tree0a9357fdc0cc63217fcf49bd3523d2a47e79c806 /src
parentdc0383ea1c14db56cbdbde5f1d38eb6c1f6d672d (diff)
downloadmv-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.gz
mv-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.bz2
mv-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.xz
mv-bfc5d7483c0a81409ebf08603f634e88b8db03f8.zip
Add setting to allow and not allow move character by mouse.
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/viewport.cpp17
-rw-r--r--src/gui/viewport.h1
-rw-r--r--src/gui/widgets/tabs/setup_players.cpp4
4 files changed, 18 insertions, 5 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 596f56f47..22c38e9b7 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -400,6 +400,7 @@ DefaultsData* getConfigDefaults()
AddDEF("enableIdCollecting", false);
AddDEF("checkOpenGLVersion", true);
AddDEF("openglContext", false);
+ AddDEF("allowMoveByMouse", true);
return configData;
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index db8af7ebe..a491e191a 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -93,6 +93,7 @@ Viewport::Viewport() :
mEnableLazyScrolling(config.getBoolValue("enableLazyScrolling")),
mMouseDirectionMove(config.getBoolValue("mouseDirectionMove")),
mLongMouseClick(config.getBoolValue("longmouseclick")),
+ mAllowMoveByMouse(config.getBoolValue("allowMoveByMouse")),
mMouseClicked(false),
mPlayerFollowMouse(false)
{
@@ -106,6 +107,7 @@ Viewport::Viewport() :
config.addListener("enableLazyScrolling", this);
config.addListener("mouseDirectionMove", this);
config.addListener("longmouseclick", this);
+ config.addListener("allowMoveByMouse", this);
setFocusable(true);
updateMidVars();
@@ -524,10 +526,12 @@ bool Viewport::leftMouseAction()
validateSpeed();
localPlayer->stopAttack();
localPlayer->cancelFollow();
- mPlayerFollowMouse = true;
-
- // Make the player go to the mouse position
- followMouse();
+ mPlayerFollowMouse = mAllowMoveByMouse;
+ if (mPlayerFollowMouse)
+ {
+ // Make the player go to the mouse position
+ followMouse();
+ }
}
return false;
}
@@ -833,7 +837,8 @@ void Viewport::mouseDragged(MouseEvent &event)
mPlayerFollowMouse = false;
return;
}
- if (mMouseClicked &&
+ if (mAllowMoveByMouse &&
+ mMouseClicked &&
localPlayer &&
localPlayer->canMove())
{
@@ -894,6 +899,8 @@ void Viewport::optionChanged(const std::string &name)
mMouseDirectionMove = config.getBoolValue("mouseDirectionMove");
else if (name == "longmouseclick")
mLongMouseClick = config.getBoolValue("longmouseclick");
+ else if (name == "allowMoveByMouse")
+ mAllowMoveByMouse = config.getBoolValue("allowMoveByMouse");
}
void Viewport::mouseMoved(MouseEvent &event)
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index aa2c09832..3dad7c920 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -244,6 +244,7 @@ class Viewport final : public WindowContainer,
bool mEnableLazyScrolling;
bool mMouseDirectionMove;
bool mLongMouseClick;
+ bool mAllowMoveByMouse;
bool mMouseClicked;
bool mPlayerFollowMouse;
};
diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp
index ca3506aa4..cca3acee9 100644
--- a/src/gui/widgets/tabs/setup_players.cpp
+++ b/src/gui/widgets/tabs/setup_players.cpp
@@ -165,6 +165,10 @@ Setup_Players::Setup_Players(const Widget2 *const widget) :
"", "enableRemoteCommands", this, "enableRemoteCommandsEvent",
MainConfig_false);
+ // TRANSLATORS: settings option
+ new SetupItemCheckBox(_("Allow move character by mouse"),
+ "", "allowMoveByMouse", this, "allowMoveByMouseEvent");
+
setDimension(Rect(0, 0, 550, 350));
}