diff options
author | Fate <fate-tmw@googlemail.com> | 2008-11-23 11:52:51 -0700 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2008-11-23 11:52:51 -0700 |
commit | ba0d53c6234562b1826dfeb58d02e49757c2ce5b (patch) | |
tree | 2134447b73b89215c824dde6e6d520bbe35c8083 /src/itemshortcut.cpp | |
parent | d011f8f984f454a76adaf04142df0daa03dd00a8 (diff) | |
parent | 31f40703d569478619952343bde3f73c3a576847 (diff) | |
download | mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.gz mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.bz2 mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.tar.xz mana-ba0d53c6234562b1826dfeb58d02e49757c2ce5b.zip |
Merge branch '0.0' of git@gitorious.org:tmw/mainline into 0.0
Diffstat (limited to 'src/itemshortcut.cpp')
-rw-r--r-- | src/itemshortcut.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index a32e50e0..babe3dfb 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -17,8 +17,6 @@ * You should have received a copy of the GNU General Public License * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ */ #include "itemshortcut.h" @@ -64,14 +62,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); } } @@ -81,6 +73,16 @@ void ItemShortcut::useItem(int index) { Item *item = player_node->getInventory()->findItem(mItems[index]); if (item && item->getQuantity()) - player_node->useItem(item); + { + if (item->isEquipment()) { + if (item->isEquipped()) { + player_node->unequipItem(item); + } else { + player_node->equipItem(item); + } + } else { + player_node->useItem(item); + } + } } } |