summaryrefslogtreecommitdiff
path: root/src/itemshortcut.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-02-11 09:30:26 +0000
committerDavid Athay <ko2fan@gmail.com>2009-02-11 09:30:26 +0000
commit91111ca5d13072ea3b834e23835df9c077329e39 (patch)
treef0af8dd08b766164835cf9b5412a9aa3267dbad7 /src/itemshortcut.cpp
parent8046bb2626b30fecdcea54eb0aa3349cdb7d277b (diff)
parent63ac001daa7dfc0735dfefd9c2829c8786b4edaf (diff)
downloadmana-91111ca5d13072ea3b834e23835df9c077329e39.tar.gz
mana-91111ca5d13072ea3b834e23835df9c077329e39.tar.bz2
mana-91111ca5d13072ea3b834e23835df9c077329e39.tar.xz
mana-91111ca5d13072ea3b834e23835df9c077329e39.zip
Merge branch 'master' of git@gitorious.org:tmw/eathena
Diffstat (limited to 'src/itemshortcut.cpp')
-rw-r--r--src/itemshortcut.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index ee887c73..3404b0e3 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -19,11 +19,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "itemshortcut.h"
-
#include "configuration.h"
#include "inventory.h"
#include "item.h"
+#include "itemshortcut.h"
#include "localplayer.h"
#include "utils/tostring.h"
@@ -34,9 +33,8 @@ ItemShortcut::ItemShortcut():
mItemSelected(-1)
{
for (int i = 0; i < SHORTCUT_ITEMS; i++)
- {
mItems[i] = -1;
- }
+
load();
}
@@ -52,9 +50,7 @@ void ItemShortcut::load()
int itemId = (int) config.getValue("shortcut" + toString(i), -1);
if (itemId != -1)
- {
mItems[i] = itemId;
- }
}
}
@@ -74,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);
}
}