From 89c332adbcf584142d49f6829d5227614f2f0968 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 13 Dec 2008 16:51:38 +0100 Subject: Added ability to add equipment to the shurtcut bar Patch by Nikos, with some improvements. Conflicts: NEWS src/gui/itemcontainer.cpp src/itemshortcut.cpp (cherry picked from eAthena client, not functional here yet) --- src/itemshortcut.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/itemshortcut.cpp') diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index a89da974..bea14864 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -61,14 +61,8 @@ void ItemShortcut::save() { for (int i = 0; i < SHORTCUT_ITEMS; i++) { - if (mItems[i]) - { - config.setValue("shortcut" + toString(i), mItems[i]); - } - else - { - config.setValue("shortcut" + toString(i), -1); - } + const int itemId = mItems[i] ? mItems[i] : -1; + config.setValue("shortcut" + toString(i), itemId); } } @@ -77,9 +71,20 @@ void ItemShortcut::useItem(int index) if (mItems[index]) { Item *item = player_node->searchForItem(mItems[index]); - if (item && item->getQuantity()) { + if (item && item->getQuantity()) + { // TODO: Fix this (index vs. pointer mismatch) - //player_node->useItem(item); + /* + if (item->isEquipment()) { + if (item->isEquipped()) { + player_node->unequipItem(item); + } else { + player_node->equipItem(item); + } + } else { + player_node->useItem(item); + } + */ } } } -- cgit v1.2.3-70-g09d2