From 308ac7d7ad3e8b46caaa80c024a5e22c6fd645f0 Mon Sep 17 00:00:00 2001 From: Andrew James Date: Mon, 21 Mar 2022 10:30:06 +1100 Subject: [PATCH] Use PointsInRectangleRange with a starting position (#4202) --- Source/qol/stash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/qol/stash.cpp b/Source/qol/stash.cpp index 0b5037eda..9a7e8c9f3 100644 --- a/Source/qol/stash.cpp +++ b/Source/qol/stash.cpp @@ -110,8 +110,8 @@ void CheckStashPaste(Point cursorPosition) // Check that no more then 1 item is replaced by the move uint16_t it = 0; - for (auto point : PointsInRectangleRange({ { 0, 0 }, itemSize })) { - uint16_t iv = Stash.stashGrids[Stash.GetPage()][firstSlot.x + point.x][firstSlot.y + point.y]; + for (auto point : PointsInRectangleRange({ firstSlot, itemSize })) { + uint16_t iv = Stash.stashGrids[Stash.GetPage()][point.x][point.y]; if (iv == 0 || it == iv) continue; if (it == 0) { @@ -648,8 +648,8 @@ bool AutoPlaceItemInStash(Player &player, const Item &item, bool persistItem) for (auto stashPosition : PointsInRectangleRange({ { 0, 0 }, { 10 - (itemSize.width - 1), 10 - (itemSize.height - 1) } })) { // Check that all needed slots are free bool isSpaceFree = true; - for (auto itemPoint : PointsInRectangleRange({ { 0, 0 }, itemSize })) { - uint16_t iv = Stash.stashGrids[pageIndex][stashPosition.x + itemPoint.x][stashPosition.y + itemPoint.y]; + for (auto itemPoint : PointsInRectangleRange({ stashPosition, itemSize })) { + uint16_t iv = Stash.stashGrids[pageIndex][itemPoint.x][itemPoint.y]; if (iv != 0) { isSpaceFree = false; break;