summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-19 23:22:41 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-19 23:22:41 +0300
commit50658d0b86e7fcd0ea92449310b1dbcc75237267 (patch)
tree888e3c812b869995d13bd33cc0591d94ccade2e9
parentce234e915f6ee5557e6cc00b6aa9fd9b3bdbc152 (diff)
downloadplus-50658d0b86e7fcd0ea92449310b1dbcc75237267.tar.gz
plus-50658d0b86e7fcd0ea92449310b1dbcc75237267.tar.bz2
plus-50658d0b86e7fcd0ea92449310b1dbcc75237267.tar.xz
plus-50658d0b86e7fcd0ea92449310b1dbcc75237267.zip
Block moving in storage is open.
Move some code from being to playerinfo.
-rw-r--r--src/being.cpp5
-rw-r--r--src/being.h2
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/playerinfo.cpp10
-rw-r--r--src/playerinfo.h2
6 files changed, 15 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp
index b8e50b764..2f1555246 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2015,11 +2015,6 @@ void Being::talkTo()
Net::getNpcHandler()->talk(mId);
}
-bool Being::isTalking()
-{
- return NpcDialog::isActive() || NpcPostDialog::isActive();
-}
-
bool Being::draw(Graphics *graphics, int offsetX, int offsetY) const
{
bool res = true;
diff --git a/src/being.h b/src/being.h
index 1d9e1691d..725163d9c 100644
--- a/src/being.h
+++ b/src/being.h
@@ -632,8 +632,6 @@ class Being : public ActorSprite, public ConfigListener
void talkTo();
- static bool isTalking();
-
bool draw(Graphics *graphics, int offsetX, int offsetY) const;
bool drawSpriteAt(Graphics *graphics, int x, int y) const;
diff --git a/src/game.cpp b/src/game.cpp
index 9aad672da..e5a86f4a3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -759,7 +759,7 @@ void Game::resetAdjustLevel()
void Game::handleMove()
{
// Moving player around
- if (player_node->isAlive() && !Being::isTalking()
+ if (player_node->isAlive() && !PlayerInfo::isTalking()
&& chatWindow && !chatWindow->isInputFocused()
&& !InventoryWindow::isAnyInputFocused() && !quitDialog)
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 319476591..2a8d36a60 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -33,6 +33,7 @@
#include "localplayer.h"
#include "map.h"
#include "maplayer.h"
+#include "playerinfo.h"
#include "textmanager.h"
#include "gui/beingpopup.h"
@@ -409,7 +410,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
// Check if we are busy
// if commented, allow context menu if npc dialog open
- if (Being::isTalking())
+ if (PlayerInfo::isTalking())
return;
const int pixelX = event.getX() + mPixelViewX;
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index d00eb217d..61d72df3b 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -28,6 +28,10 @@
#include "listener.h"
#include "logger.h"
+#include "gui/inventorywindow.h"
+#include "gui/npcdialog.h"
+#include "gui/npcpostdialog.h"
+
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
@@ -368,4 +372,10 @@ void deinit()
mListener = nullptr;
}
+bool isTalking()
+{
+ return NpcDialog::isActive() || NpcPostDialog::isActive()
+ || InventoryWindow::isStorageActive();
+}
+
} // namespace PlayerInfo
diff --git a/src/playerinfo.h b/src/playerinfo.h
index 36a8bb799..46204638f 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -229,6 +229,8 @@ namespace PlayerInfo
void deinit();
+ bool isTalking();
+
void triggerAttr(int id);
void triggerAttr(int id, int old);