Continue improving mouse|inventory interface

This commit is contained in:
2024-11-21 21:04:07 +00:00
parent efef41c9e1
commit 1250e2442a
9 changed files with 165 additions and 148 deletions
+12
View File
@@ -15,6 +15,7 @@ module Dodge.Inventory (
swapInvItems,
scrollAugNextInSection,
isFilteringInv,
swapItemWith,
) where
import qualified Data.IntSet as IS
@@ -174,6 +175,7 @@ changeSwapClose f i w = fromMaybe w $ do
k <- f i ss
return $
w
& swapAnyExtraSelection i k
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . ispCloseObject
.~ k
& hud . closeObjects %~ swapIndices i k
@@ -255,6 +257,16 @@ isConnected x = case x ^. locLdtContext of
|| not (null $ x ^. locLDT . ldtLeft)
_ -> True
swapItemWith ::
(Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) ->
(Int,Int) ->
World ->
World
swapItemWith f (j,i) w = case j of
0 -> w & swapInvItems f i
3 -> w & changeSwapClose f i
_ -> w
changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
changeSwapWith f w = case w ^? hud . hudElement . diSelection . _Just of
Just (0, i) -> w & swapInvItems f i