Fix extra item swapping
This commit is contained in:
@@ -334,14 +334,14 @@ changeInvSel i w
|
|||||||
|
|
||||||
changeSwapInvSel :: Int -> World -> World
|
changeSwapInvSel :: Int -> World -> World
|
||||||
changeSwapInvSel k w
|
changeSwapInvSel k w
|
||||||
| n == 0 = w
|
|
||||||
| yourInvSel w < n =
|
| yourInvSel w < n =
|
||||||
w
|
w
|
||||||
& cWorld . lWorld . creatures . ix 0 %~ updatecreature
|
& cWorld . lWorld . creatures . ix 0 %~ updatecreature
|
||||||
| otherwise =
|
| yourInvSel w > n =
|
||||||
w
|
w
|
||||||
& cWorld . lWorld . creatures . ix 0 . crInvSel . iselPos .~ ico'
|
& 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
|
where
|
||||||
updatecreature =
|
updatecreature =
|
||||||
(crInv %~ IM.safeSwapKeys (i `mod` n) swapi)
|
(crInv %~ IM.safeSwapKeys (i `mod` n) swapi)
|
||||||
@@ -360,7 +360,7 @@ changeSwapInvSel k w
|
|||||||
| swapi == li = i
|
| swapi == li = i
|
||||||
| otherwise = li
|
| otherwise = li
|
||||||
i = crSel cr
|
i = crSel cr
|
||||||
ico' = ((i - (k + n)) `mod` numCO) + n
|
ico' = ((i - (k + n + 1)) `mod` numCO) + n + 1
|
||||||
n = length $ _crInv cr
|
n = length $ _crInv cr
|
||||||
numCO = length $ w ^. cWorld . lWorld . closeObjects
|
numCO = length $ w ^. cWorld . lWorld . closeObjects
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ drawSubInventory subinv cfig w = case subinv of
|
|||||||
extrapics
|
extrapics
|
||||||
closeobjectcursor = case selectedCloseObject w of
|
closeobjectcursor = case selectedCloseObject w of
|
||||||
Nothing -> mempty
|
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) ->
|
-- Just (i, co) ->
|
||||||
-- listCursorNS
|
-- listCursorNS
|
||||||
-- clObjFloatIn
|
-- clObjFloatIn
|
||||||
|
|||||||
Reference in New Issue
Block a user