diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inventorywindow.cpp | 16 | ||||
-rw-r--r-- | src/inventory.cpp | 16 | ||||
-rw-r--r-- | src/inventory.h | 3 |
3 files changed, 31 insertions, 4 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 978bfcecf..f63e01d6a 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -61,15 +61,23 @@ InventoryWindow::WindowList InventoryWindow::instances; InventoryWindow::InventoryWindow(Inventory *inventory): - Window(inventory ? (inventory->isMainInventory() - ? _("Inventory") : _("Storage")) : _("Inventory")), + Window(), mInventory(inventory), mDropButton(0), mSplit(false) { - listen(CHANNEL_ATTRIBUTES); + if (inventory) + { + setCaption(gettext(inventory->getName().c_str())); + setWindowName(inventory->getName()); + } + else + { + setCaption(_("Inventory")); + setWindowName("Inventory"); + } - setWindowName(isMainInventory() ? "Inventory" : "Storage"); + listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); diff --git a/src/inventory.cpp b/src/inventory.cpp index 23387cadb..f9956798f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -28,6 +28,8 @@ #include "resources/iteminfo.h" +#include "utils/gettext.h" + #include <algorithm> #include <string> @@ -223,3 +225,17 @@ Item *Inventory::findItemBySprite(std::string spritePath, Gender gender) return 0; } + +std::string Inventory::getName() +{ + switch (mType) + { + case INVENTORY: + default: + return N_("Inventory"); + case STORAGE: + return N_("Storage"); + case CART: + return N_("Cart"); + } +} diff --git a/src/inventory.h b/src/inventory.h index c09492e22..c40a9bd5b 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -50,6 +50,7 @@ class Inventory { INVENTORY = 0, STORAGE, + CART, TRADE, TYPE_END }; @@ -145,6 +146,8 @@ class Inventory Item *findItemBySprite(std::string spritePath, Gender gender); + std::string getName(); + protected: typedef std::list<InventoryListener*> InventoryListenerList; InventoryListenerList mInventoryListeners; |