diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 17 | ||||
-rw-r--r-- | src/gui/viewport.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_players.cpp | 4 |
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)); } |