diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-21 22:39:53 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-21 22:39:53 +0000 |
commit | e4e3f73db10d345453f2c6d06ae1dc499a4c7404 (patch) | |
tree | 7117443cf1267f9354206c21d70ac4ae0ddefcec /src/gui/inventory.cpp | |
parent | 241e2461446a830194f202b840abcd3598f804a5 (diff) | |
download | mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.gz mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.bz2 mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.xz mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.zip |
Numerous things:
* Fixed two non-virtual destructor warnings showing up with GCC 4.
* Fixed OpenGL inventory text drawing that broke in last commit
* Removed glClear cause screen is redrawn completely anyway
* Fixed updating of buttons in inventory window
* Made items.xml be loaded through resource manager.
Diffstat (limited to 'src/gui/inventory.cpp')
-rw-r--r-- | src/gui/inventory.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 4a1c0ca3..f73c240e 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -76,6 +76,13 @@ InventoryWindow::~InventoryWindow() delete itemDescriptionLabel; } +void InventoryWindow::logic() +{ + // It would be nicer if this update could be event based, needs some + // redesign of InventoryWindow and ItemContainer probably. + updateButtons(); +} + int InventoryWindow::addItem(int index, int id, int quantity, bool equipment) { items->addItem(index, id, quantity, equipment); @@ -90,14 +97,12 @@ int InventoryWindow::removeItem(int id) int InventoryWindow::changeQuantity(int index, int quantity) { - //items[index].quantity = quantity; items->changeQuantity(index, quantity); return 0; } int InventoryWindow::increaseQuantity(int index, int quantity) { - //items[index].quantity += quantity; items->increaseQuantity(index, quantity); return 0; } @@ -147,8 +152,8 @@ void InventoryWindow::action(const std::string &eventId) if (selectedItem != -1) { if (eventId == "use") { - if(items->isEquipment(selectedItem)) { - if(items->isEquipped(selectedItem)) { + if (items->isEquipment(selectedItem)) { + if (items->isEquipped(selectedItem)) { unequipItem(selectedItem); } else { @@ -164,8 +169,6 @@ void InventoryWindow::action(const std::string &eventId) // Choose amount of items to drop new ItemAmountWindow(AMOUNT_ITEM_DROP, this); } - - updateUseButton(); } } @@ -173,8 +176,6 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count) { Window::mouseClick(x, y, button, count); - updateUseButton(); - if (items->getIndex() != -1) { // Show Name and Description @@ -213,7 +214,7 @@ void InventoryWindow::updateWidgets() setContentSize(getWidth(), getHeight()); } -void InventoryWindow::updateUseButton() +void InventoryWindow::updateButtons() { if (items->getIndex() != -1 && items->isEquipment(items->getIndex())) { @@ -229,4 +230,5 @@ void InventoryWindow::updateUseButton() } useButton->setEnabled(items->getIndex() != -1); + dropButton->setEnabled(items->getIndex() != -1); } |