From 450edb5900a46ada0cc6292f0079a31ea5d04573 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 7 Feb 2009 21:51:35 -0700 Subject: Some more include cleanups. Signed-off-by: Ira Rice --- src/itemshortcut.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/itemshortcut.cpp') diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index 7bfbc88e..3404b0e3 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -33,9 +33,8 @@ ItemShortcut::ItemShortcut(): mItemSelected(-1) { for (int i = 0; i < SHORTCUT_ITEMS; i++) - { mItems[i] = -1; - } + load(); } @@ -51,9 +50,7 @@ void ItemShortcut::load() int itemId = (int) config.getValue("shortcut" + toString(i), -1); if (itemId != -1) - { mItems[i] = itemId; - } } } @@ -73,13 +70,15 @@ void ItemShortcut::useItem(int index) Item *item = player_node->getInventory()->findItem(mItems[index]); if (item && item->getQuantity()) { - if (item->isEquipment()) { - if (item->isEquipped()) { + if (item->isEquipment()) + { + if (item->isEquipped()) player_node->unequipItem(item); - } else { + else player_node->equipItem(item); - } - } else { + } + else + { player_node->useItem(item); } } -- cgit v1.2.3-70-g09d2