diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-08-26 16:55:05 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-08-26 16:55:05 +0200 |
commit | 6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d (patch) | |
tree | 4e6e178095ac8cf89dc0dba4f532913891305436 /src/gui/inventorywindow.cpp | |
parent | ee8f131b49bb9b1d66cac3840b3c566eb49bcf3f (diff) | |
download | mana-6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d.tar.gz mana-6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d.tar.bz2 mana-6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d.tar.xz mana-6d9dbf93e6c0247cb9b19d3f52a1837a5833b22d.zip |
Merged testing branch into master.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 5df1d4ba..6ad1b05f 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -97,7 +97,8 @@ InventoryWindow::InventoryWindow(Inventory *inventory): longestUseString = unequip; } - mUseButton = new Button(longestUseString, "use", this); + mEquipButton = new Button(_("Equip"), "equip", this); + mUseButton = new Button(_("Activate"), "activate", this); mDropButton = new Button(_("Drop..."), "drop", this); mSplitButton = new Button(_("Split"), "split", this); mOutfitButton = new Button(_("Outfits"), "outfit", this); @@ -111,8 +112,9 @@ InventoryWindow::InventoryWindow(Inventory *inventory): place(5, 0, mSlotsBar, 2); place(0, 1, invenScroll, 7).setPadding(3); place(0, 2, mUseButton); - place(1, 2, mDropButton); - place(2, 2, mSplitButton); + place(1, 2, mEquipButton); + place(2, 2, mDropButton); + place(3, 2, mSplitButton); place(6, 2, mOutfitButton); updateWeight(); @@ -183,9 +185,11 @@ void InventoryWindow::action(const gcn::ActionEvent &event) if (!item) return; - if (event.getId() == "use") + if (event.getId() == "activate") + item->doEvent("doUse"); + else if (event.getId() == "equip") { - if (item->isEquipment()) + if (item->isEquippable()) { if (item->isEquipped()) item->doEvent("doUnequip"); @@ -193,7 +197,9 @@ void InventoryWindow::action(const gcn::ActionEvent &event) item->doEvent("doEquip"); } else + { item->doEvent("doUse"); + } } else if (event.getId() == "drop") { @@ -309,25 +315,26 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event) if (!item || item->getQuantity() == 0) { mUseButton->setEnabled(false); + mEquipButton->setEnabled(false); mDropButton->setEnabled(false); return; } - mUseButton->setEnabled(true); mDropButton->setEnabled(true); - if (item->isEquipment()) + if (item->getInfo().getEquippable()) { if (item->isEquipped()) - mUseButton->setCaption(_("Unequip")); + mEquipButton->setCaption(_("Unequip")); else - mUseButton->setCaption(_("Equip")); + mEquipButton->setCaption(_("Equip")); + mEquipButton->setEnabled(true); } else - { - mUseButton->setCaption(_("Use")); - } + mEquipButton->setEnabled(false); + + mUseButton->setEnabled(item->getInfo().getActivatable()); if (item->getQuantity() > 1) mDropButton->setCaption(_("Drop...")); |