diff options
author | Jan-Fabian Humann <malastare@gmx.net> | 2005-04-04 22:35:58 +0000 |
---|---|---|
committer | Jan-Fabian Humann <malastare@gmx.net> | 2005-04-04 22:35:58 +0000 |
commit | ca03f5a83dbd379d21c20ed4e69ec6836395b694 (patch) | |
tree | 93b49faa836f53c3b65e9e78b55b9d5d487f5a7e /src/gui/itemcontainer.cpp | |
parent | acb216cbbd50f68710502068bec83e073128d6fc (diff) | |
download | mana-ca03f5a83dbd379d21c20ed4e69ec6836395b694.tar.gz mana-ca03f5a83dbd379d21c20ed4e69ec6836395b694.tar.bz2 mana-ca03f5a83dbd379d21c20ed4e69ec6836395b694.tar.xz mana-ca03f5a83dbd379d21c20ed4e69ec6836395b694.zip |
starting to do the trade window, i know it's not functionable and contains a lot of bugs but ill continue tomorrow.
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index d76fc3d9..aa60d322 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -54,7 +54,7 @@ void ItemContainer::draw(gcn::Graphics* graphics) getAbsolutePosition(x, y); w = getWidth(); h = getHeight(); - + graphics->setColor(gcn::Color(0, 0, 0)); graphics->drawRectangle(gcn::Rectangle(0, 0, w, h)); if(items[selectedItem].quantity <= 0) @@ -135,6 +135,17 @@ void ItemContainer::addItem(int index, int id, int quantity, bool equipment) items[index].equipment = equipment; } +int ItemContainer::getFreeSlot() +{ + for (int i = 0; i < INVENTORY_SIZE; i++) { + printf("i %d id %d\n", i, items[i].id); + if (items[i].id == -1) { + return i; + } + } + return -1; +} + void ItemContainer::resetItems() { for (int i = 0; i < INVENTORY_SIZE; i++) { |