summaryrefslogtreecommitdiff
path: root/src/itemshortcut.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-07 21:51:35 -0700
committerIra Rice <irarice@gmail.com>2009-02-07 21:51:35 -0700
commit450edb5900a46ada0cc6292f0079a31ea5d04573 (patch)
treea8b110ef8c1057da3c7d8fb9f1fbcdf88327db88 /src/itemshortcut.cpp
parent303609031d8b70f0b20002b28e2de450e0ad7fb7 (diff)
downloadmana-450edb5900a46ada0cc6292f0079a31ea5d04573.tar.gz
mana-450edb5900a46ada0cc6292f0079a31ea5d04573.tar.bz2
mana-450edb5900a46ada0cc6292f0079a31ea5d04573.tar.xz
mana-450edb5900a46ada0cc6292f0079a31ea5d04573.zip
Some more include cleanups.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/itemshortcut.cpp')
-rw-r--r--src/itemshortcut.cpp17
1 files changed, 8 insertions, 9 deletions
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);
}
}