summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index ec825ae3..880994d7 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +38,7 @@
#include "../inventory.h"
#include "../item.h"
+#include "../units.h"
#include "../resources/iteminfo.h"
@@ -51,7 +51,7 @@ InventoryWindow::InventoryWindow(int invSize):
mMaxSlots(invSize),
mItemDesc(false)
{
- setWindowName(_("Inventory"));
+ setWindowName("Inventory");
setResizable(true);
setCloseButton(true);
@@ -77,8 +77,8 @@ InventoryWindow::InventoryWindow(int invSize):
mInvenScroll = new ScrollArea(mItems);
mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTotalWeight = toString(player_node->mTotalWeight);
- mMaxWeight = toString(player_node->mMaxWeight);
+ mTotalWeight = -1;
+ mMaxWeight = -1;
mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed());
mSlotsLabel = new gcn::Label(_("Slots: "));
@@ -99,7 +99,7 @@ InventoryWindow::InventoryWindow(int invSize):
place(6, 5, mUseButton);
Layout &layout = getLayout();
- layout.setRowHeight(0, mDropButton->getHeight());
+ layout.setRowHeight(0, mDropButton->getHeight());
loadWindowState();
setLocationRelativeTo(getParent());
@@ -118,12 +118,12 @@ void InventoryWindow::logic()
// redesign of InventoryWindow and ItemContainer probably.
updateButtons();
- if ((mMaxWeight != toString(player_node->mMaxWeight)) ||
- mTotalWeight != toString(player_node->mTotalWeight) ||
+ if (mMaxWeight != player_node->mMaxWeight ||
+ mTotalWeight != player_node->mTotalWeight ||
mUsedSlots != toString(player_node->getInventory()->getNumberOfSlotsUsed()))
{
- mTotalWeight = toString(player_node->mTotalWeight);
- mMaxWeight = toString(player_node->mMaxWeight);
+ mTotalWeight = player_node->mTotalWeight;
+ mMaxWeight = player_node->mMaxWeight;
mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed());
// Weight Bar coloration
@@ -148,8 +148,9 @@ void InventoryWindow::logic()
player_node->mMaxWeight);
mSlotsBar->setText(strprintf("%s/%d", mUsedSlots.c_str(), mMaxSlots));
- mWeightBar->setText(strprintf("%sg/%sg", mTotalWeight.c_str(),
- mMaxWeight.c_str()));
+ mWeightBar->setText(strprintf("%s/%s",
+ Units::formatWeight(mTotalWeight).c_str(),
+ Units::formatWeight(mMaxWeight).c_str()));
}
}