summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dragdrop.h22
-rw-r--r--src/gui/outfitwindow.cpp5
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp5
3 files changed, 19 insertions, 13 deletions
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 3c7167aaf..e58263cc9 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -207,28 +207,40 @@ class DragDrop
mSelItemColor = 1;
}
- int getSelected()
+ int getSelected() const
{ return mSelItem; }
- int getSelectedColor()
+ int getSelectedColor() const
{ return mSelItemColor; }
- bool isSelected()
+ bool isSelected() const
{ return mSelItem > 0; }
void clearItem(const Item *const item A_UNUSED)
{
}
- const std::string &getText()
+ const std::string &getText() const
{ return mText; }
- int getTag()
+ int getTag() const
{ return mTag; }
void setItem(const int item)
{ mItem = item; }
+ bool isSourceItemContainer() const
+ {
+ return mSource == DRAGDROP_SOURCE_INVENTORY
+ || mSource == DRAGDROP_SOURCE_STORAGE
+ || mSource == DRAGDROP_SOURCE_CART
+ || mSource == DRAGDROP_SOURCE_TRADE
+ || mSource == DRAGDROP_SOURCE_OUTFIT
+ || mSource == DRAGDROP_SOURCE_GROUND
+ || mSource == DRAGDROP_SOURCE_DROP
+ || mSource == DRAGDROP_SOURCE_CRAFT;
+ }
+
private:
int mItem;
uint8_t mItemColor;
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index a95d6fe2f..e1c36fd90 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -473,10 +473,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event)
event.consume();
if (!dragDrop.isEmpty())
{
- DragDropSource src = dragDrop.getSource();
- if (src == DRAGDROP_SOURCE_INVENTORY
- || src == DRAGDROP_SOURCE_OUTFIT
- || src == DRAGDROP_SOURCE_DROP)
+ if (dragDrop.isSourceItemContainer())
{
mItems[mCurrentOutfit][index] = dragDrop.getItem();
mItemColors[mCurrentOutfit][index] = dragDrop.getItemColor();
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index f74db990b..e26183116 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -254,10 +254,7 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event)
}
if (!dragDrop.isEmpty())
{
- DragDropSource src = dragDrop.getSource();
- if (src == DRAGDROP_SOURCE_INVENTORY
- || src == DRAGDROP_SOURCE_OUTFIT
- || src == DRAGDROP_SOURCE_DROP)
+ if (dragDrop.isSourceItemContainer())
{
dropShortcut->setItems(index, dragDrop.getItem(),
dragDrop.getItemColor());