diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-10 15:55:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-10 15:55:59 +0300 |
commit | bfc5d7483c0a81409ebf08603f634e88b8db03f8 (patch) | |
tree | 0a9357fdc0cc63217fcf49bd3523d2a47e79c806 /src/gui/viewport.cpp | |
parent | dc0383ea1c14db56cbdbde5f1d38eb6c1f6d672d (diff) | |
download | plus-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.gz plus-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.bz2 plus-bfc5d7483c0a81409ebf08603f634e88b8db03f8.tar.xz plus-bfc5d7483c0a81409ebf08603f634e88b8db03f8.zip |
Add setting to allow and not allow move character by mouse.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
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) |