summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordweems <dweems000@gmail.com>2010-08-03 12:19:59 -0500
committerJared Adams <jaxad0127@gmail.com>2010-08-03 11:27:06 -0600
commit4c27bfbf6ca84546e5b914b7909df14dd2966081 (patch)
treebeaff23db71ce071a763ca75efe9530f1d1b2b20 /src
parent59143e174f946c66e2e437e32b6f6b28c506115a (diff)
downloadmana-4c27bfbf6ca84546e5b914b7909df14dd2966081.tar.gz
mana-4c27bfbf6ca84546e5b914b7909df14dd2966081.tar.bz2
mana-4c27bfbf6ca84546e5b914b7909df14dd2966081.tar.xz
mana-4c27bfbf6ca84546e5b914b7909df14dd2966081.zip
Added double click to equip unequip and use items
-Double-click items in invetory to equip/unequip -Double-click items in inventory to use Signed-off-by: Jared Adams <jaxad0127@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/itemcontainer.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 5163fc45..7648eb24 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -255,14 +255,46 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
if (mSelectedIndex == index)
{
- mSelectionStatus = SEL_DESELECTING;
+ if(event.getClickCount() == 2)
+ {
+ if (item->isEquipment())
+ {
+ if (item->isEquipped())
+ Net::getInventoryHandler()->unequipItem(item);
+ else
+ Net::getInventoryHandler()->equipItem(item);
+ }
+ else
+ Net::getInventoryHandler()->useItem(item);
+
+ }
+ else
+ {
+ mSelectionStatus = SEL_DESELECTING;
+ }
}
else if (item && item->getId())
{
- setSelectedIndex(index);
- mSelectionStatus = SEL_SELECTING;
+ if(event.getClickCount() == 2)
+ {
+ if (item->isEquipment())
+ {
+ if (item->isEquipped())
+ Net::getInventoryHandler()->unequipItem(item);
+ else
+ Net::getInventoryHandler()->equipItem(item);
+ }
+ else
+ Net::getInventoryHandler()->useItem(item);
- itemShortcut->setItemSelected(item->getId());
+ }
+ else
+ {
+ setSelectedIndex(index);
+ mSelectionStatus = SEL_SELECTING;
+
+ itemShortcut->setItemSelected(item->getId());
+ }
if (item->isEquipment())
outfitWindow->setItemSelected(item->getId());
}