diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-02-20 11:32:50 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-02-20 11:32:50 +0000 |
commit | 3135c725cc37251943271cd8f939e646c9164259 (patch) | |
tree | 159ae31b1c0518d37f5bb21344fe3c72bf5cc382 /src/gui/itemcontainer.cpp | |
parent | 54a359f67da79d97df667299ea4d91cef79c08f2 (diff) | |
download | Mana-3135c725cc37251943271cd8f939e646c9164259.tar.gz Mana-3135c725cc37251943271cd8f939e646c9164259.tar.bz2 Mana-3135c725cc37251943271cd8f939e646c9164259.tar.xz Mana-3135c725cc37251943271cd8f939e646c9164259.zip |
Finally equipment! Sometimes it works :P
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 0bd236e2..195f9188 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -38,6 +38,7 @@ ItemContainer::ItemContainer() items[i].id = -1; items[i].quantity = 0; items[i].equipment = false; + items[i].equipped = false; } } @@ -66,7 +67,8 @@ void ItemContainer::draw(gcn::Graphics* graphics) } std::stringstream ss; - ss << items[i].quantity; + if(!items[i].equipped) + ss << items[i].quantity; graphics->drawText(ss.str(), 24 * i + 10, 24 + 2, gcn::Graphics::CENTER); } @@ -83,6 +85,16 @@ int ItemContainer::getIndex() return selectedItem; } +int ItemContainer::getIndex(int id) +{ + for (int i = 0; i < INVENTORY_SIZE; i++) { + if (items[i].id == id) { + return i; + } + } + return -1; +} + int ItemContainer::getId() { if (selectedItem != -1) { @@ -161,3 +173,13 @@ bool ItemContainer::isEquipment(int index) { return items[index].equipment; } + +bool ItemContainer::isEquipped(int index) +{ + return items[index].equipped; +} + +void ItemContainer::setEquipped(int index, bool equipped) +{ + items[index].equipped = equipped; +} |