summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-02 15:07:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-02 22:48:10 +0300
commite54b8369a982585445c84c8590bdb1c16701763f (patch)
tree77f4ce5c37ad45f3bc3aa42f644b818025f92af2
parent610b19c083565f1f6c153fadff80fc0e7475168f (diff)
downloadmv-e54b8369a982585445c84c8590bdb1c16701763f.tar.gz
mv-e54b8369a982585445c84c8590bdb1c16701763f.tar.bz2
mv-e54b8369a982585445c84c8590bdb1c16701763f.tar.xz
mv-e54b8369a982585445c84c8590bdb1c16701763f.zip
Not allow moving while vending shop enabled.
-rw-r--r--src/input/inputcondition.h37
-rw-r--r--src/input/inputmanager.cpp7
-rw-r--r--src/net/eathena/vendinghandler.cpp4
3 files changed, 29 insertions, 19 deletions
diff --git a/src/input/inputcondition.h b/src/input/inputcondition.h
index 353393dd6..de479b328 100644
--- a/src/input/inputcondition.h
+++ b/src/input/inputcondition.h
@@ -25,30 +25,31 @@ namespace InputCondition
{
enum Type
{
- DEFAULT = 1, // default condition
- ENABLED = 2, // keyboard must be enabled
- NOINPUT = 4, // input items must be unfocused
- NOAWAY = 8, // player not in away mode
- NOSETUP = 16, // setup window is hidde
+ DEFAULT = 1, // default condition
+ ENABLED = 2, // keyboard must be enabled
+ NOINPUT = 4, // input items must be unfocused
+ NOAWAY = 8, // player not in away mode
+ NOSETUP = 16, // setup window is hidde
VALIDSPEED = 32, // valid speed
- NOMODAL = 64, // modal windows inactive
+ NOMODAL = 64, // modal windows inactive
NONPCINPUT = 128, // npc input field inactive
- EMODS = 256, // game modifiers enabled
- NOTARGET = 512, // no target/untarget keys
+ EMODS = 256, // game modifiers enabled
+ NOTARGET = 512, // no target/untarget keys
// pressed
- NOFOLLOW = 1024, // follow mode disabled
- INGAME = 2048, // game must be started
- NOBUYSELL = 4096, // no active buy or sell dialogs
+ NOFOLLOW = 1024, // follow mode disabled
+ INGAME = 2048, // game must be started
+ NOBUYSELL = 4096, // no active buy or sell dialogs
NONPCDIALOG = 8192, // no active npc dialog or
// dialog almost closed
- NOTALKING = 16384, // player have no opened
+ NOTALKING = 16384, // player have no opened
// dialogs what prevent moving
- ALIVE = 32768, // player alive
- SHORTCUT = 2 + 4 + 16 + 512 + 2048, // flags for shortcut keys
- SHORTCUT0 = 2 + 4 + 16 + 512, // flags for shortcut keys
- GAME = 2 + 4 + 8 + 16 + 64 + 2048, // main game key
- GAME2 = 2 + 8 + 16 + 64 + 2048,
- ARROWKEYS = 2 + 4 + 8 + 16 + 64 + 2048 + 4096 + 16384
+ ALIVE = 32768, // player alive
+ NOVENDING = 65536, // vending disabled
+ SHORTCUT = 2 + 4 + 16 + 512 + 2048, // flags for shortcut keys
+ SHORTCUT0 = 2 + 4 + 16 + 512, // flags for shortcut keys
+ GAME = 2 + 4 + 8 + 16 + 64 + 2048, // main game key
+ GAME2 = 2 + 8 + 16 + 64 + 2048,
+ ARROWKEYS = 2 + 4 + 8 + 16 + 64 + 2048 + 4096 + 16384 + 65536
};
} // namespace InputCondition
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index 7500116cf..dcb4b57a7 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -25,11 +25,13 @@
#include "settings.h"
#include "touchmanager.h"
+#include "being/localplayer.h"
+#include "being/playerinfo.h"
+
#include "input/inputactionmap.h"
#include "input/inputactionsortfunctor.h"
#include "input/joystick.h"
#include "input/keyboardconfig.h"
-#include "being/localplayer.h"
#ifdef USE_SDL2
#include "input/multitouchmanager.h"
#endif
@@ -688,6 +690,9 @@ void InputManager::updateConditionMask()
if (!BuyDialog::isActive() && !SellDialog::isActive())
mMask |= InputCondition::NOBUYSELL;
+ if (!PlayerInfo::isVending())
+ mMask |= InputCondition::NOVENDING;
+
if (!settings.awayMode)
mMask |= InputCondition::NOAWAY;
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index 823709b6f..9e3e00117 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -124,7 +124,10 @@ void VendingHandler::processHideBoard(Net::MessageIn &msg)
if (dstBeing)
dstBeing->setBoard(std::string());
if (dstBeing == localPlayer)
+ {
+ PlayerInfo::enableVending(false);
VendingModeListener::distributeEvent(false);
+ }
}
void VendingHandler::processItemsList(Net::MessageIn &msg)
@@ -197,6 +200,7 @@ void VendingHandler::processReport(Net::MessageIn &msg)
void VendingHandler::close() const
{
createOutPacket(CMSG_VENDING_CLOSE);
+ PlayerInfo::enableVending(false);
}
void VendingHandler::open(const Being *const being) const