diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-03 17:28:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-03 17:34:35 +0300 |
commit | 3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22 (patch) | |
tree | a23f62ac777b630fb2f313b95a2a69e3c97b902a | |
parent | 5d742f63283c4c2c12f1539f1d69ab3bef7be396 (diff) | |
download | manaverse-3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22.tar.gz manaverse-3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22.tar.bz2 manaverse-3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22.tar.xz manaverse-3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22.zip |
In inventory disable use button if selected item unusable.
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 18 | ||||
-rw-r--r-- | src/resources/itemtypemapdata.h | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index ee9641927..5a29d5de0 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -630,21 +630,29 @@ void InventoryWindow::updateButtons(const Item *item) if (!item || item->getQuantity() == 0) { if (mUseButton) - mUseButton->setEnabled(true); + mUseButton->setEnabled(false); if (mDropButton) - mDropButton->setEnabled(true); + mDropButton->setEnabled(false); return; } - if (mUseButton) - mUseButton->setEnabled(true); if (mDropButton) mDropButton->setEnabled(true); if (mUseButton) { const ItemInfo &info = item->getInfo(); - mUseButton->setCaption(info.getUseButton()); + const std::string &str = info.getUseButton(); + if (str.empty()) + { + mUseButton->setEnabled(false); + mUseButton->setCaption(_("Use")); + } + else + { + mUseButton->setEnabled(true); + mUseButton->setCaption(str); + } } updateDropButton(); diff --git a/src/resources/itemtypemapdata.h b/src/resources/itemtypemapdata.h index b1412414c..5a5ad8fea 100644 --- a/src/resources/itemtypemapdata.h +++ b/src/resources/itemtypemapdata.h @@ -30,7 +30,7 @@ ItemTypeMap itemTypeMap[] = { // TRANSLATORS: inventory button - {"generic", ItemType::UNUSABLE, N_("Use")}, + {"generic", ItemType::UNUSABLE, std::string()}, // TRANSLATORS: inventory button {"other", ItemType::UNUSABLE, N_("Use")}, // TRANSLATORS: inventory button @@ -62,9 +62,9 @@ ItemTypeMap itemTypeMap[] = // TRANSLATORS: inventory button {"equip-ammo", ItemType::EQUIPMENT_AMMO, N_("Equip")}, // TRANSLATORS: inventory button - {"racesprite", ItemType::SPRITE_RACE, N_("Use")}, + {"racesprite", ItemType::SPRITE_RACE, std::string()}, // TRANSLATORS: inventory button - {"hairsprite", ItemType::SPRITE_HAIR, N_("Use")}, + {"hairsprite", ItemType::SPRITE_HAIR, std::string()}, }; #endif // RESOURCES_ITEMTYPEMAPDATA_H |