summaryrefslogtreecommitdiff
path: root/src/gui/statuswindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-10 03:38:34 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-10 03:38:34 +0200
commitc117ead1f66522c7b8cb29b4179a78e7dc775d28 (patch)
tree4152b3cb42b648c18f7b5fbf96565767109abd58 /src/gui/statuswindow.cpp
parent61470cb03d26a9c6059c33b0f0e16125f5f6eae4 (diff)
downloadplus-c117ead1f66522c7b8cb29b4179a78e7dc775d28.tar.gz
plus-c117ead1f66522c7b8cb29b4179a78e7dc775d28.tar.bz2
plus-c117ead1f66522c7b8cb29b4179a78e7dc775d28.tar.xz
plus-c117ead1f66522c7b8cb29b4179a78e7dc775d28.zip
Add weight bar to top left corner (hidden by default).
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r--src/gui/statuswindow.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 8dc1ed46d..853c490bf 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -522,6 +522,31 @@ void StatusWindow::updateProgressBar(ProgressBar *bar, int id, bool percent)
updateProgressBar(bar, exp.first, exp.second, percent);
}
+void StatusWindow::updateWeightBar(ProgressBar *bar, bool percent)
+{
+ if (!bar)
+ return;
+
+ if (PlayerInfo::getAttribute(MAX_WEIGHT) == 0)
+ {
+ bar->setText(_("Max"));
+ bar->setProgress(1.0);
+ }
+ else
+ {
+ float progress = static_cast<float>(
+ PlayerInfo::getAttribute(TOTAL_WEIGHT))
+ / static_cast<float>(PlayerInfo::getAttribute(MAX_WEIGHT));
+
+ bar->setText(strprintf("%s/%s", Units::formatWeight(
+ PlayerInfo::getAttribute(TOTAL_WEIGHT)).c_str(),
+ Units::formatWeight(PlayerInfo::getAttribute(
+ MAX_WEIGHT)).c_str()));
+
+ bar->setProgress(progress);
+ }
+}
+
void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent _UNUSED_)
{
if (!player_node || !viewport)