Fix extra item swapping

This commit is contained in:
2022-12-25 23:55:48 +00:00
parent d2141d90ae
commit be1a48062f
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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