summaryrefslogtreecommitdiff
path: root/src/gui/ministatus.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-10 04:15:39 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-10 04:15:39 +0200
commitf74cf5eb61deccc478d2a4cbc7a352748d96c65e (patch)
tree1f5c31014cc82a4ad079374ecfb775fe847b8d80 /src/gui/ministatus.cpp
parentc117ead1f66522c7b8cb29b4179a78e7dc775d28 (diff)
downloadplus-f74cf5eb61deccc478d2a4cbc7a352748d96c65e.tar.gz
plus-f74cf5eb61deccc478d2a4cbc7a352748d96c65e.tar.bz2
plus-f74cf5eb61deccc478d2a4cbc7a352748d96c65e.tar.xz
plus-f74cf5eb61deccc478d2a4cbc7a352748d96c65e.zip
Add inventory slots bar in top left corner (hidden by default).
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r--src/gui/ministatus.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 71e81abf8..ab894b3a8 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -87,6 +87,9 @@ MiniStatusWindow::MiniStatusWindow():
mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT,
"weight bar", _("weight bar"));
+ mInvSlotsBar = createBar(0, 45, 20, Theme::PROG_INVY_SLOTS,
+ "inventory slots bar", _("inventory slots bar"));
+
mStatusBar = createBar(100, 150, 20, Theme::PROG_EXP,
"status bar", _("status bar"));
@@ -99,6 +102,9 @@ MiniStatusWindow::MiniStatusWindow():
mTextPopup = new TextPopup();
addMouseListener(this);
+ Inventory *inv = PlayerInfo::getInventory();
+ if (inv)
+ inv->addInventoyListener(this);
updateStatus();
}
@@ -109,6 +115,10 @@ MiniStatusWindow::~MiniStatusWindow()
delete mStatusPopup;
mStatusPopup = 0;
+ Inventory *inv = PlayerInfo::getInventory();
+ if (inv)
+ inv->removeInventoyListener(this);
+
std::list <ProgressBar*>::iterator it, it_end;
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
{
@@ -203,7 +213,7 @@ void MiniStatusWindow::event(Channels channel _UNUSED_,
else if (id == EXP || id == EXP_NEEDED)
StatusWindow::updateXPBar(mXpBar);
else if (id == TOTAL_WEIGHT || id == MAX_WEIGHT)
- StatusWindow::updateWeightBar(mWeightBar, false);
+ StatusWindow::updateWeightBar(mWeightBar);
}
else if (event.getName() == EVENT_UPDATESTAT)
{
@@ -348,10 +358,12 @@ void MiniStatusWindow::showBar(std::string name, bool isVisible)
void MiniStatusWindow::loadBars()
{
- if (!config.getValue("ministatussaved", false))
+ if (!config.getValue("ministatussaved", 0))
{
if (mWeightBar)
mWeightBar->setVisible(false);
+ if (mInvSlotsBar)
+ mInvSlotsBar->setVisible(false);
return;
}
@@ -386,4 +398,13 @@ void MiniStatusWindow::saveBars()
config.deleteKey("ministatus" + toString(f));
config.setValue("ministatussaved", true);
-} \ No newline at end of file
+}
+
+void MiniStatusWindow::slotsChanged(Inventory* inventory)
+{
+ if (!inventory)
+ return;
+
+ if (inventory->getType() == Inventory::INVENTORY)
+ StatusWindow::updateInvSlotsBar(mInvSlotsBar);
+}