summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-04 22:28:08 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-04 22:28:08 +0000
commit90290b7aaf2a55187598e67c31d33f5735f574ce (patch)
tree64826ee1d40e993ab70c9d6f077ded33c747edf0 /src/gui
parent4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac (diff)
downloadmana-90290b7aaf2a55187598e67c31d33f5735f574ce.tar.gz
mana-90290b7aaf2a55187598e67c31d33f5735f574ce.tar.bz2
mana-90290b7aaf2a55187598e67c31d33f5735f574ce.tar.xz
mana-90290b7aaf2a55187598e67c31d33f5735f574ce.zip
Client-side hack for picking up items.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemcontainer.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 5bcd000d..2c84b19b 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -48,7 +48,7 @@ ItemContainer::ItemContainer(Inventory *inventory):
mSelImg = resman->getImage("graphics/gui/selection.png");
if (!mSelImg) logger->error("Unable to load selection.png");
- mMaxItems = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
+ mMaxItems = mInventory->getLastUsedSlot() + 1;
addMouseListener(this);
}
@@ -62,7 +62,7 @@ void ItemContainer::logic()
{
gcn::Widget::logic();
- int i = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
+ int i = mInventory->getLastUsedSlot() + 1;
if (i != mMaxItems) {
mMaxItems = i;
@@ -89,11 +89,7 @@ void ItemContainer::draw(gcn::Graphics* graphics)
selectNone();
}
- /*
- * 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.
- */
- for (int i = 2; i < INVENTORY_SIZE; i++)
+ for (int i = 0; i < INVENTORY_SIZE; i++)
{
Item *item = mInventory->getItem(i);
@@ -101,8 +97,8 @@ void ItemContainer::draw(gcn::Graphics* graphics)
continue;
}
- int itemX = ((i - 2) % columns) * gridWidth;
- int itemY = ((i - 2) / columns) * gridHeight;
+ int itemX = (i % columns) * gridWidth;
+ int itemY = (i / columns) * gridHeight;
// Draw selection image below selected item
if (mSelectedItem == item)
@@ -141,8 +137,7 @@ void ItemContainer::setWidth(int width)
columns = 1;
}
- setHeight(((mMaxItems / columns) +
- (mMaxItems % columns > 0 ? 1 : 0)) * gridHeight);
+ setHeight((mMaxItems + columns - 1) / columns * gridHeight);
}
Item* ItemContainer::getItem()
@@ -184,7 +179,7 @@ void ItemContainer::mousePress(int mx, int my, int button)
if (button == gcn::MouseInput::LEFT || gcn::MouseInput::RIGHT)
{
- int index = mx / gridWidth + ((my / gridHeight) * columns) + 2;
+ int index = mx / gridWidth + ((my / gridHeight) * columns);
if (index > INVENTORY_SIZE) {
index = INVENTORY_SIZE - 1;