diff options
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index fb5105b2..d448c3c2 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -32,7 +32,6 @@ #include "gui/outfitwindow.h" #include "gui/palette.h" #include "gui/sdlinput.h" -#include "gui/theme.h" #include "gui/viewport.h" #include "net/net.h" @@ -40,6 +39,7 @@ #include "resources/image.h" #include "resources/iteminfo.h" +#include "resources/theme.h" #include "utils/stringutils.h" @@ -263,7 +263,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) mSelectionStatus = SEL_SELECTING; itemShortcut->setItemSelected(item->getId()); - if (item->isEquipment()) + if (item->getInfo().getEquippable()) outfitWindow->setItemSelected(item->getId()); } else @@ -305,7 +305,14 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) return; if (index == mSelectedIndex || mSelectedIndex == -1) return; - Net::getInventoryHandler()->moveItem(mSelectedIndex, index); + + Item *item = getSelectedItem(); + { + Mana::Event event("doMove"); + event.setItem("item", item); + event.setInt("newIndex", index); + event.trigger("Item"); + } selectNone(); } @@ -372,8 +379,11 @@ void ItemContainer::keyAction() mSelectedIndex != -1 && mHighlightedIndex != -1) { - Net::getInventoryHandler()->moveItem( - mSelectedIndex, mHighlightedIndex); + Item *item = getSelectedItem(); + Mana::Event event("doMove"); + event.setItem("item", item); + event.setInt("newIndex", mHighlightedIndex); + event.trigger("Item"); setSelectedIndex(mHighlightedIndex); } // If the highlight is on an item then select it. @@ -385,8 +395,11 @@ void ItemContainer::keyAction() // If the highlight is on a blank space then move it. else if (mSelectedIndex != -1) { - Net::getInventoryHandler()->moveItem( - mSelectedIndex, mHighlightedIndex); + Item *item = getSelectedItem(); + Mana::Event event("doMove"); + event.setItem("item", item); + event.setInt("newIndex", mHighlightedIndex); + event.trigger("Item"); selectNone(); } } |