summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp8
-rw-r--r--src/gui/inventorywindow.h5
-rw-r--r--src/gui/npcdialog.cpp5
-rw-r--r--src/gui/npcdialog.h5
-rw-r--r--src/gui/npcpostdialog.cpp4
-rw-r--r--src/gui/npcpostdialog.h5
-rw-r--r--src/gui/popupmenu.cpp3
7 files changed, 18 insertions, 17 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index fb7d1c8c..3bb84ab8 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -140,13 +140,19 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
slotsChanged(mInventory);
if (!isMainInventory())
+ {
setVisible(true);
+ PlayerInfo::setStorageCount(PlayerInfo::getStorageCount() + 1);
+ }
}
InventoryWindow::~InventoryWindow()
{
instances.remove(this);
mInventory->removeInventoyListener(this);
+
+ if (!isMainInventory())
+ PlayerInfo::setStorageCount(PlayerInfo::getStorageCount() - 1);
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -236,7 +242,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
- if (isStorageActive() && keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ if (instances.size() > 1 && keyboard.isKeyActive(keyboard.KEY_EMOTE))
{
Item *item = mItems->getSelectedItem();
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 3adbc1cc..af72106b 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -107,11 +107,6 @@ class InventoryWindow : public Window,
bool isMainInventory() { return mInventory->isMainInventory(); }
- /**
- * Returns true if any instances exist.
- */
- static bool isStorageActive() { return instances.size() > 1; }
-
void event(const std::string &channel, const Mana::Event &event);
private:
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 828ed776..c9eaff10 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -22,6 +22,7 @@
#include "gui/npcdialog.h"
#include "configuration.h"
+#include "playerinfo.h"
#include "gui/setup.h"
@@ -123,6 +124,8 @@ NpcDialog::NpcDialog(int npcId)
requestFocus();
config.addListener("logNpcInGui", this);
+ PlayerInfo::setNPCInteractionCount(PlayerInfo::getNPCInteractionCount()
+ + 1);
}
NpcDialog::~NpcDialog()
@@ -139,6 +142,8 @@ NpcDialog::~NpcDialog()
instances.remove(this);
config.removeListener("logNpcInGui", this);
+ PlayerInfo::setNPCInteractionCount(PlayerInfo::getNPCInteractionCount()
+ - 1);
}
void NpcDialog::setText(const std::string &text)
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index 26ff9c1a..561cceb9 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -154,11 +154,6 @@ class NpcDialog : public Window, public gcn::ActionListener,
void optionChanged(const std::string &name);
/**
- * Returns true if any instances exist.
- */
- static bool isActive() { return instances.size() > 0; }
-
- /**
* Returns the first active instance. Useful for pushing user
* interaction.
*/
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 74173ae9..6bc79017 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -22,6 +22,7 @@
#include "gui/npcpostdialog.h"
#include "eventmanager.h"
+#include "playerinfo.h"
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
@@ -79,11 +80,14 @@ NpcPostDialog::NpcPostDialog(int npcId):
instances.push_back(this);
setVisible(true);
+
+ PlayerInfo::setNPCPostCount(PlayerInfo::getNPCPostCount() + 1);
}
NpcPostDialog::~NpcPostDialog()
{
instances.remove(this);
+ PlayerInfo::setNPCPostCount(PlayerInfo::getNPCPostCount() - 1);
}
void NpcPostDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/npcpostdialog.h b/src/gui/npcpostdialog.h
index ad0053a3..248e4515 100644
--- a/src/gui/npcpostdialog.h
+++ b/src/gui/npcpostdialog.h
@@ -47,11 +47,6 @@ public:
void setVisible(bool visible);
/**
- * Returns true if any instances exist.
- */
- static bool isActive() { return instances.size() > 0; }
-
- /**
* Closes all instances.
*/
static void closeAll();
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 76569d38..7bf1d4fb 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -28,6 +28,7 @@
#include "item.h"
#include "localplayer.h"
#include "log.h"
+#include "playerinfo.h"
#include "playerrelations.h"
#include "gui/chat.h"
@@ -381,7 +382,7 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split")));
}
- if (InventoryWindow::isStorageActive())
+ if (PlayerInfo::getStorageCount() > 0)
{
mBrowserBox->addRow(strprintf("@@store|%s@@", _("Store")));
}