summaryrefslogtreecommitdiff
path: root/src/gui/itemcontainer.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-28 01:01:10 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-28 01:02:44 +0100
commitb2df8047e6c2d1215ef7debf1a42e02188725471 (patch)
tree0d826f7d0fcd911ddcfd53eaf96afe6e5d585e5f /src/gui/itemcontainer.cpp
parenta5ed5126e8498d53a5f843d591ff183951418d1f (diff)
downloadmana-client-b2df8047e6c2d1215ef7debf1a42e02188725471.tar.gz
mana-client-b2df8047e6c2d1215ef7debf1a42e02188725471.tar.bz2
mana-client-b2df8047e6c2d1215ef7debf1a42e02188725471.tar.xz
mana-client-b2df8047e6c2d1215ef7debf1a42e02188725471.zip
Make the full inventory accessible again
Was broken due to tmwserv having only 50 as opposed to 100 places in the inventory at the moment.
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r--src/gui/itemcontainer.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index bd180f28..70cf8176 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -281,9 +281,11 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
};
int index = getSlotIndex(event.getX(), event.getY());
- if (index == Inventory::NO_SLOT_INDEX) return;
+ if (index == Inventory::NO_SLOT_INDEX)
+ return;
Item *item = mInventory->getItem(index);
- if (item == mSelectedItem) return;
+ if (item == mSelectedItem)
+ return;
player_node->moveInvItem(mSelectedItem, index);
setSelectedItem(NULL);
mSelectionStatus = SEL_NONE;
@@ -314,12 +316,12 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event)
mItemPopup->setVisible(false);
}
-int ItemContainer::getSlotIndex(const int posX, const int posY) const
+int ItemContainer::getSlotIndex(int x, int y) const
{
- if (getDimension().isPointInRect(posX, posY))
+ if (x < getWidth() && y < getHeight())
{
// Takes into account, boxes are overlapping each other.
- return (posY / (BOX_HEIGHT - 1)) * mGridColumns + (posX / (BOX_WIDTH - 1));
+ return (y / (BOX_HEIGHT - 1)) * mGridColumns + (x / (BOX_WIDTH - 1));
}
return Inventory::NO_SLOT_INDEX;
}