summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 13:25:04 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 13:25:24 +0100
commitdd05447445dc1766e532130318af2cb6bb72a994 (patch)
treec8b2cbac64ccf9545a39c143088b57fe2cb8e678 /src/gui/inventorywindow.cpp
parent05e753294c1a603252d2eed4b1731c3f50543a7e (diff)
parent2aab736bc5d77ffda789d7de56cef100fac207e1 (diff)
downloadmana-dd05447445dc1766e532130318af2cb6bb72a994.tar.gz
mana-dd05447445dc1766e532130318af2cb6bb72a994.tar.bz2
mana-dd05447445dc1766e532130318af2cb6bb72a994.tar.xz
mana-dd05447445dc1766e532130318af2cb6bb72a994.zip
Merge branch 'aethyra/master'
Conflicts: src/beingmanager.cpp src/gui/confirm_dialog.cpp src/gui/inventorywindow.cpp src/gui/inventorywindow.h src/gui/label.cpp src/gui/label.h src/gui/popup.cpp src/gui/popup.h src/gui/scrollarea.cpp src/gui/skin.cpp src/gui/skin.h src/gui/speechbubble.cpp src/gui/window.cpp src/gui/window.h src/localplayer.h src/main.cpp src/net/ea/playerhandler.cpp src/resources/ambientoverlay.h src/resources/dye.cpp src/resources/imagewriter.cpp src/resources/itemdb.cpp src/shopitem.cpp
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 5a5d8db6..21d2df3f 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -44,7 +44,6 @@
#include "../resources/iteminfo.h"
#include "../utils/gettext.h"
-#include "../utils/stringutils.h"
#include "../utils/strprintf.h"
InventoryWindow::InventoryWindow(int invSize):
@@ -92,7 +91,7 @@ InventoryWindow::InventoryWindow(int invSize):
mTotalWeight = -1;
mMaxWeight = -1;
- mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed());
+ mUsedSlots = -1;
mSlotsLabel = new Label(_("Slots: "));
mWeightLabel = new Label(_("Weight: "));
@@ -137,29 +136,28 @@ void InventoryWindow::logic()
updateButtons();
const int usedSlots = player_node->getInventory()->getNumberOfSlotsUsed();
- const std::string usedSlotsStr = toString(usedSlots);
if (mMaxWeight != player_node->getMaxWeight() ||
- mTotalWeight != player_node->getTotalWeight() ||
- mUsedSlots != usedSlotsStr)
+ mTotalWeight != player_node->getTotalWeight() ||
+ mUsedSlots != usedSlots)
{
mTotalWeight = player_node->getTotalWeight();
mMaxWeight = player_node->getMaxWeight();
- mUsedSlots = usedSlotsStr;
+ mUsedSlots = usedSlots;
// Weight Bar coloration
- if (mTotalWeight < (int) (mMaxWeight / 3))
+ if (mTotalWeight < (mMaxWeight / 3))
mWeightBar->setColor(0, 0, 255); // Blue
- else if (mTotalWeight < (int) ((mMaxWeight * 2) / 3))
+ else if (mTotalWeight < ((mMaxWeight * 2) / 3))
mWeightBar->setColor(255, 255, 0); // Yellow
else
mWeightBar->setColor(255, 0, 0); // Red
// Adjust progress bars
- mSlotsBar->setProgress((float) usedSlots / mMaxSlots);
+ mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots);
mWeightBar->setProgress((float) mTotalWeight / mMaxWeight);
- mSlotsBar->setText(strprintf("%s/%d", mUsedSlots.c_str(), mMaxSlots));
+ mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots));
mWeightBar->setText(strprintf("%s/%s",
Units::formatWeight(mTotalWeight).c_str(),
Units::formatWeight(mMaxWeight).c_str()));