diff options
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 997e1af7f..972c066ac 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -409,22 +409,25 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) } else if (item && item->getId()) { - dragDrop.dragItem(item, DRAGDROP_SOURCE_INVENTORY); - dragDrop.select(item); - setSelectedIndex(index); - mSelectionStatus = SEL_SELECTING; - - if (itemShortcutWindow) + if (index >= 0) { - const int num = itemShortcutWindow->getTabIndex(); - if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)) + dragDrop.dragItem(item, DRAGDROP_SOURCE_INVENTORY); + dragDrop.select(item); + setSelectedIndex(index); + mSelectionStatus = SEL_SELECTING; + + if (itemShortcutWindow) { - if (itemShortcut[num]) - itemShortcut[num]->setItemSelected(item); + const int num = itemShortcutWindow->getTabIndex(); + if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)) + { + if (itemShortcut[num]) + itemShortcut[num]->setItemSelected(item); + } } + if (shopWindow) + shopWindow->setItemSelected(item->getId()); } - if (shopWindow) - shopWindow->setItemSelected(item->getId()); } else { |