diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-30 21:50:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-30 21:50:44 +0300 |
commit | ce1919c195962ef683ad0af7ee33ce7973c0f03c (patch) | |
tree | 82e676b48be80032b8bc2023443890082f4a6792 | |
parent | 5b6848e817bea37e286f197f8702ab29f1de3bc8 (diff) | |
download | plus-ce1919c195962ef683ad0af7ee33ce7973c0f03c.tar.gz plus-ce1919c195962ef683ad0af7ee33ce7973c0f03c.tar.bz2 plus-ce1919c195962ef683ad0af7ee33ce7973c0f03c.tar.xz plus-ce1919c195962ef683ad0af7ee33ce7973c0f03c.zip |
Fix resize item container in npc dialog.
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 8 |
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; } |