summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-25 18:29:35 -0700
committerIra Rice <irarice@gmail.com>2009-01-25 18:29:35 -0700
commit6544a9fbe8c601f5333569a9f59131c3f6700595 (patch)
treef4d39cfb260d302aad2f2e6c112d634ec9a7ade3
parentdecf5b650667830fcfe0838688ed0ca12481399f (diff)
downloadmana-6544a9fbe8c601f5333569a9f59131c3f6700595.tar.gz
mana-6544a9fbe8c601f5333569a9f59131c3f6700595.tar.bz2
mana-6544a9fbe8c601f5333569a9f59131c3f6700595.tar.xz
mana-6544a9fbe8c601f5333569a9f59131c3f6700595.zip
Modified the inventory window to be more TMW translation friendly.
Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r--src/gui/inventorywindow.cpp25
-rw-r--r--src/gui/inventorywindow.h5
2 files changed, 19 insertions, 11 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 64227c2d..76f83996 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -38,7 +38,6 @@
#include "../inventory.h"
#include "../item.h"
-#include "../localplayer.h"
#include "../resources/iteminfo.h"
@@ -46,8 +45,9 @@
#include "../utils/strprintf.h"
#include "../utils/tostring.h"
-InventoryWindow::InventoryWindow():
+InventoryWindow::InventoryWindow(int invSize):
Window(_("Inventory")),
+ mSize(invSize),
mItemDesc(false)
{
setWindowName(_("Inventory"));
@@ -69,10 +69,13 @@ InventoryWindow::InventoryWindow():
mTotalWeight = toString(player_node->mTotalWeight);
mMaxWeight = toString(player_node->mMaxWeight);
- mWeight = _("Weight: ") + mTotalWeight + " g / " +
- mMaxWeight + _(" g Slots: ") +
- toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
- "/" + toString(player_node->getInventory()->getInventorySize());
+ mWeight = strprintf(_("Weight: %d g / %d g"),
+ player_node->mTotalWeight,
+ player_node->mMaxWeight) + " " +
+ strprintf(_("Slots used: %d / %d"),
+ player_node->getInventory()->getNumberOfSlotsUsed(),
+ mSize);
+
mWeightLabel = new gcn::Label(mWeight);
setMinHeight(130);
@@ -108,10 +111,12 @@ void InventoryWindow::logic()
mMaxWeight = toString(player_node->mMaxWeight);
// Adjust widgets
- mWeight = _("Weight: ") + mTotalWeight + " g / " +
- mMaxWeight + _(" g Slots: ") +
- toString(player_node->getInventory()->getNumberOfSlotsUsed()) +
- "/" + toString(player_node->getInventory()->getInventorySize());
+ mWeight = strprintf(_("Weight: %d g / %d g"),
+ player_node->mTotalWeight,
+ player_node->mMaxWeight) + " " +
+ strprintf(_("Slots used: %d / %d"),
+ player_node->getInventory()->getNumberOfSlotsUsed(),
+ mSize);
setMinWidth(getFont()->getWidth(mWeight));
}
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 000112e8..33b6ff52 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -29,6 +29,7 @@
#include "window.h"
#include "../guichanfwd.h"
+#include "../localplayer.h"
class Item;
class ItemContainer;
@@ -45,7 +46,7 @@ class InventoryWindow : public Window, gcn::ActionListener,
/**
* Constructor.
*/
- InventoryWindow();
+ InventoryWindow(int invSize = INVENTORY_SIZE);
/**
* Logic (updates buttons and weight information).
@@ -76,6 +77,8 @@ class InventoryWindow : public Window, gcn::ActionListener,
gcn::ScrollArea *mInvenScroll;
gcn::Label *mWeightLabel;
+ int mSize;
+
bool mItemDesc;
};