Continue improving mouse|inventory interface
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user