From 2f925bfeb7ef15354af9e468cde03c08c822d0fa Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 18 Oct 2021 21:23:57 +0200 Subject: [PATCH] [gamepad] Prevent warping from row 9 and 10 to belt --- Source/controls/plrctrls.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/controls/plrctrls.cpp b/Source/controls/plrctrls.cpp index d1122ed98..9c71b6839 100644 --- a/Source/controls/plrctrls.cpp +++ b/Source/controls/plrctrls.cpp @@ -851,8 +851,8 @@ void InvMove(AxisDirection dir) mousePos = GetSlotCoord(Slot); } else if (Slot <= SLOTXY_INV_LAST && myPlayer.HoldItem._itype == ItemType::Misc && icursSize28 == Size { 1, 1 }) { // forcing only 1x1 misc items Slot += INV_ROW_SLOT_SIZE; - if (Slot > SLOTXY_BELT_LAST) - Slot = SLOTXY_BELT_LAST; + if (Slot + INV_ROW_SLOT_SIZE <= SLOTXY_BELT_LAST) + Slot += INV_ROW_SLOT_SIZE; mousePos = GetSlotCoord(Slot); } } else { @@ -883,9 +883,8 @@ void InvMove(AxisDirection dir) mousePos = GetSlotCoord(Slot); } else if (Slot <= SLOTXY_INV_LAST) { Size itemSize = GetItemSizeOnSlot(Slot); - Slot += itemSize.height * INV_ROW_SLOT_SIZE; - if (Slot > SLOTXY_BELT_LAST) - Slot = SLOTXY_BELT_LAST; + if (Slot + itemSize.height * INV_ROW_SLOT_SIZE <= SLOTXY_BELT_LAST) + Slot += itemSize.height * INV_ROW_SLOT_SIZE; mousePos = GetSlotCoord(Slot); } }