summaryrefslogtreecommitdiff
path: root/src/actionmanager.cpp
diff options
context:
space:
mode:
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)