summaryrefslogtreecommitdiff
path: root/src/input/inputmanager.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/input/inputmanager.cpp
parent6fcb5c4b9f03dd3e4b9fea0475aec2c21a8510bc (diff)
downloadmv-b863927543393468a7153775c18ef04a59f20a7f.tar.gz
mv-b863927543393468a7153775c18ef04a59f20a7f.tar.bz2
mv-b863927543393468a7153775c18ef04a59f20a7f.tar.xz
mv-b863927543393468a7153775c18ef04a59f20a7f.zip
allow auto close npc dialog if it almost closed and press moving keys.
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r--src/input/inputmanager.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index c8c63dc4f..645bfe351 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -24,11 +24,11 @@
#include "game.h"
#include "touchmanager.h"
-#include "being/localplayer.h"
-
#include "input/joystick.h"
#include "input/keyboardconfig.h"
#include "input/keyboarddata.h"
+#include "being/localplayer.h"
+#include "being/playerinfo.h"
#ifdef USE_SDL2
#include "input/multitouchmanager.h"
#endif
@@ -340,6 +340,8 @@ bool InputManager::isActionActive(const int index) const
return false;
const KeyData &key = keyData[index];
+// logger->log("isActionActive mask=%d, condition=%d, index=%d",
+// mMask, key.condition, index);
if ((key.condition & mMask) != key.condition)
return false;
return true;
@@ -688,6 +690,12 @@ void InputManager::updateConditionMask()
const NpcDialog *const dialog = NpcDialog::getActive();
if (!dialog || !dialog->isTextInputFocused())
mMask |= COND_NONPCINPUT;
+ if (!dialog || dialog->isCloseState())
+ {
+ mMask |= COND_NONPCDIALOG;
+ if (!InventoryWindow::isStorageActive())
+ mMask |= COND_NOTALKING;
+ }
if (!player_node || !player_node->getDisableGameModifiers())
mMask |= COND_EMODS;
@@ -706,7 +714,7 @@ void InputManager::updateConditionMask()
bool InputManager::checkKey(const KeyData *const key) const
{
-// logger->log("mask=%d, condition=%d", mMask, key->condition);
+ //logger->log("checkKey mask=%d, condition=%d", mMask, key->condition);
if (!key || (key->condition & mMask) != key->condition)
return false;