From be1a48062f471bea3a95a1cfeb3392674f4418f8 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 25 Dec 2022 23:55:48 +0000 Subject: [PATCH] Fix extra item swapping --- src/Dodge/Inventory.hs | 8 ++++---- src/Dodge/Render/HUD.hs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 516317fdc..2b280ce1c 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -334,14 +334,14 @@ changeInvSel i w changeSwapInvSel :: Int -> World -> World changeSwapInvSel k w - | n == 0 = w | yourInvSel w < n = w & cWorld . lWorld . creatures . ix 0 %~ updatecreature - | otherwise = + | yourInvSel w > n = w & cWorld . lWorld . creatures . ix 0 . crInvSel . iselPos .~ ico' - & cWorld . lWorld . closeObjects %~ swapIndices (i - n) (ico' - n) + & cWorld . lWorld . closeObjects %~ swapIndices (i - (n+1)) (ico' - (n+1)) + | otherwise = w where updatecreature = (crInv %~ IM.safeSwapKeys (i `mod` n) swapi) @@ -360,7 +360,7 @@ changeSwapInvSel k w | swapi == li = i | otherwise = li i = crSel cr - ico' = ((i - (k + n)) `mod` numCO) + n + ico' = ((i - (k + n + 1)) `mod` numCO) + n + 1 n = length $ _crInv cr numCO = length $ w ^. cWorld . lWorld . closeObjects diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index a4d9f1e1b..8608df92e 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -145,7 +145,7 @@ drawSubInventory subinv cfig w = case subinv of extrapics closeobjectcursor = case selectedCloseObject w of Nothing -> mempty - Just (i,co) -> drawCursorAt (invDisplayParams w & ldpCursorType .~ BorderCursor (Set.fromList [North,South])) cfig (Just i) (inventorySelectionList w) + Just (i,_) -> drawCursorAt (invDisplayParams w & ldpCursorType .~ BorderCursor (Set.fromList [North,South])) cfig (Just i) (inventorySelectionList w) -- Just (i, co) -> -- listCursorNS -- clObjFloatIn