summaryrefslogtreecommitdiff
path: root/src/gui/itemcontainer.cpp
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-09-12 17:12:24 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-09-12 17:12:24 +0000
commit8551f4a5c5e1feddc4f2868488bdefeae85aa26d (patch)
tree39b91c9d7124c1c03e954ceb9b3434adcaf022ce /src/gui/itemcontainer.cpp
parenta9595f435664df56948ae70e954cf72143ddcfa1 (diff)
downloadmana-8551f4a5c5e1feddc4f2868488bdefeae85aa26d.tar.gz
mana-8551f4a5c5e1feddc4f2868488bdefeae85aa26d.tar.bz2
mana-8551f4a5c5e1feddc4f2868488bdefeae85aa26d.tar.xz
mana-8551f4a5c5e1feddc4f2868488bdefeae85aa26d.zip
Fixed /where, added /cast for heal and gather, some changes to inventory to support storage
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r--src/gui/itemcontainer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index ce7337d2..186a2da6 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -31,6 +31,7 @@
#include "../item.h"
#include "../itemshortcut.h"
#include "../log.h"
+#include "../localplayer.h"
#include "../resources/image.h"
#include "../resources/iteminfo.h"
@@ -41,9 +42,10 @@
const int ItemContainer::gridWidth = 36; // item icon width + 4
const int ItemContainer::gridHeight = 42; // item icon height + 10
-ItemContainer::ItemContainer(Inventory *inventory):
+ItemContainer::ItemContainer(Inventory *inventory, int offset):
mInventory(inventory),
- mSelectedItem(NULL)
+ mSelectedItem(NULL),
+ mOffset(offset)
{
ResourceManager *resman = ResourceManager::getInstance();
@@ -94,10 +96,11 @@ ItemContainer::draw(gcn::Graphics *graphics)
}
/*
- * eAthena seems to start inventory from the 3rd slot. Still a mystery to
- * us why, make sure not to copy this oddity to our own server.
+ * mOffset is used to compensate for some weirdness that eAthena inherited from
+ * Ragnarok Online. Inventory slots and cart slots are +2 from their actual index,
+ * while storage slots are +1.
*/
- for (int i = 2; i < INVENTORY_SIZE; i++)
+ for (int i = mOffset; i < mInventory->getSize(); i++)
{
Item *item = mInventory->getItem(i);
@@ -194,7 +197,7 @@ ItemContainer::mousePressed(gcn::MouseEvent &event)
int columns = getWidth() / gridWidth;
int mx = event.getX();
int my = event.getY();
- int index = mx / gridWidth + ((my / gridHeight) * columns) + 2;
+ int index = mx / gridWidth + ((my / gridHeight) * columns) + mOffset;
itemShortcut->setItemSelected(-1);
// Fix for old server, it should be: if (index >= mMaxItems)