diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-06 06:11:38 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-06 06:11:38 -0600 |
commit | 9e44d5af1d7576b99553305aa7cee53dd0f6ff45 (patch) | |
tree | c6c7607f8dcfe1ac59e1e508b6a661d0b3d1f10e /src/gui/itemcontainer.cpp | |
parent | bcc4695387d21f9629ab6f013aadbfe0d238aa6d (diff) | |
download | mana-9e44d5af1d7576b99553305aa7cee53dd0f6ff45.tar.gz mana-9e44d5af1d7576b99553305aa7cee53dd0f6ff45.tar.bz2 mana-9e44d5af1d7576b99553305aa7cee53dd0f6ff45.tar.xz mana-9e44d5af1d7576b99553305aa7cee53dd0f6ff45.zip |
Clean up and expand item equip handling in the GUI
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 70cf8176..4dac0b25 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -50,8 +50,8 @@ static const int BOX_WIDTH = 36; static const int BOX_HEIGHT = 44; ItemContainer::ItemContainer(Inventory *inventory, - int gridColumns, - int gridRows): + int gridColumns, int gridRows, + bool forceQuantity): mInventory(inventory), mGridColumns(gridColumns), mGridRows(gridRows), @@ -59,7 +59,8 @@ ItemContainer::ItemContainer(Inventory *inventory, mHighlightedItem(NULL), mSelectionStatus(SEL_NONE), mSwapItems(false), - mDescItems(false) + mDescItems(false), + mForceQuantity(forceQuantity) { mItemPopup = new ItemPopup; setFocusable(true); @@ -122,15 +123,17 @@ void ItemContainer::draw(gcn::Graphics *graphics) } g->drawImage(image, itemX, itemY); } - if (item->getQuantity() > 1) { - // Draw item caption - g->drawText( - toString(item->getQuantity()), - itemX + BOX_WIDTH / 2, - itemY + BOX_HEIGHT - 14, - gcn::Graphics::CENTER); - } - + // Draw item caption + std::string caption; + if (item->getQuantity() > 1 || mForceQuantity) + caption = toString(item->getQuantity()); + else if (item->isEquipped()) + caption = "(Eq)"; + + if (item->isEquipped()) + g->setColor(guiPalette->getColor(Palette::ITEM_EQUIPED)); + g->drawText(caption, itemX + BOX_WIDTH / 2, + itemY + BOX_HEIGHT - 14, gcn::Graphics::CENTER); } } |