summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/itemcontainer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 2ec0209ee..b7af26a95 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -883,14 +883,17 @@ void ItemContainer::adjustHeight()
if (mGridRows == 0 || (mLastUsedSlot + 1) % mGridColumns > 0)
++mGridRows;
-
const unsigned int invSize = mInventory->getSize();
- const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
+ int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
std::max(invSize / mGridColumns,
static_cast<unsigned int>(mGridRows)) : mGridRows;
if (mShowEmptyRows == ShowEmptyRows_true)
+ {
+ if (mGridColumns * maxRows < invSize)
+ maxRows ++;
mGridRows = maxRows;
+ }
setHeight(maxRows * mBoxHeight);
updateMatrix();
@@ -1019,7 +1022,6 @@ int ItemContainer::getSlotByXY(int x, int y) const
if (x > mBoxWidth * mGridColumns)
return Inventory::NO_SLOT_INDEX;
const int idx = (y / mBoxHeight) * mGridColumns + (x / mBoxWidth);
- logger->log("getSlotByXY 3: %d, %d*%d", idx, mGridRows, mGridColumns);
if (idx >= 0 && idx < mGridRows * mGridColumns)
return idx;
}