summaryrefslogtreecommitdiff
path: root/src/gui/statuswindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r--src/gui/statuswindow.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 853c490bf..30fec8773 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "event.h"
+#include "inventory.h"
#include "localplayer.h"
#include "playerinfo.h"
#include "units.h"
@@ -522,7 +523,7 @@ void StatusWindow::updateProgressBar(ProgressBar *bar, int id, bool percent)
updateProgressBar(bar, exp.first, exp.second, percent);
}
-void StatusWindow::updateWeightBar(ProgressBar *bar, bool percent)
+void StatusWindow::updateWeightBar(ProgressBar *bar)
{
if (!bar)
return;
@@ -547,6 +548,24 @@ void StatusWindow::updateWeightBar(ProgressBar *bar, bool percent)
}
}
+void StatusWindow::updateInvSlotsBar(ProgressBar *bar)
+{
+ Inventory *inv = PlayerInfo::getInventory();
+ if (!inv)
+ return;
+
+ const int usedSlots = inv->getNumberOfSlotsUsed();
+ const int maxSlots = inv->getSize();
+
+ if (maxSlots)
+ {
+ bar->setProgress(static_cast<float>(usedSlots)
+ / static_cast<float>(maxSlots));
+ }
+
+ bar->setText(strprintf("%d", usedSlots));
+}
+
void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent _UNUSED_)
{
if (!player_node || !viewport)