summaryrefslogtreecommitdiff
path: root/src/actionmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-13 12:12:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-13 12:12:10 +0300
commitb863927543393468a7153775c18ef04a59f20a7f (patch)
tree56e6d7345598c0524ac4fd7310f6a85d465ce2c3 /src/actionmanager.cpp
parent6fcb5c4b9f03dd3e4b9fea0475aec2c21a8510bc (diff)
downloadplus-b863927543393468a7153775c18ef04a59f20a7f.tar.gz
plus-b863927543393468a7153775c18ef04a59f20a7f.tar.bz2
plus-b863927543393468a7153775c18ef04a59f20a7f.tar.xz
plus-b863927543393468a7153775c18ef04a59f20a7f.zip
allow auto close npc dialog if it almost closed and press moving keys.
Diffstat (limited to 'src/actionmanager.cpp')
-rw-r--r--src/actionmanager.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 9152dfe7a..cc04e60a1 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -87,28 +87,36 @@ extern QuitDialog *quitDialog;
namespace ActionManager
{
-impHandler(moveUp)
+static bool closeMoveNpcDialog(bool focus)
{
- if (NpcDialog *const dialog = NpcDialog::getActive())
+ NpcDialog *const dialog = NpcDialog::getActive();
+ if (dialog)
{
- dialog->refocus();
- return false;
+ if (dialog->isCloseState())
+ {
+ dialog->closeDialog();
+ return true;
+ }
+ else if (focus)
+ {
+ dialog->refocus();
+ }
}
+ return false;
+}
+
+impHandler(moveUp)
+{
if (inputManager.isActionActive(Input::KEY_EMOTE))
return directUp(event);
- return false;
+ return closeMoveNpcDialog(false);
}
impHandler(moveDown)
{
- if (NpcDialog *const dialog = NpcDialog::getActive())
- {
- dialog->refocus();
- return false;
- }
if (inputManager.isActionActive(Input::KEY_EMOTE))
return directDown(event);
- return false;
+ return closeMoveNpcDialog(false);
}
impHandler(moveLeft)
@@ -122,7 +130,7 @@ impHandler(moveLeft)
}
if (inputManager.isActionActive(Input::KEY_EMOTE))
return directLeft(event);
- return false;
+ return closeMoveNpcDialog(false);
}
impHandler(moveRight)
@@ -136,14 +144,14 @@ impHandler(moveRight)
}
if (inputManager.isActionActive(Input::KEY_EMOTE))
return directRight(event);
- return false;
+ return closeMoveNpcDialog(false);
}
impHandler(moveForward)
{
if (inputManager.isActionActive(Input::KEY_EMOTE))
return directRight(event);
- return false;
+ return closeMoveNpcDialog(false);
}
impHandler(emote)