Flatten HUDElement
This commit is contained in:
@@ -87,7 +87,7 @@ rmInvItem cid invid w =
|
||||
where
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
updateselectionextra
|
||||
| cid == 0 = hud . hudElement . diSelection . _Just . _3 %~ const mempty
|
||||
| cid == 0 = hud . diSelection . _Just . _3 %~ const mempty
|
||||
| otherwise = id
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
@@ -154,7 +154,7 @@ changeSwapOther ::
|
||||
World ->
|
||||
World
|
||||
changeSwapOther manlens n f i w = fromMaybe w $ do
|
||||
ss <- w ^? hud . hudElement . diSections . ix n . ssItems
|
||||
ss <- w ^? hud . diSections . ix n . ssItems
|
||||
k <- f i ss
|
||||
let doswap j
|
||||
| j == i = k
|
||||
@@ -166,7 +166,7 @@ changeSwapOther manlens n f i w = fromMaybe w $ do
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . manlens
|
||||
%~ doswap
|
||||
& hud . closeItems %~ swapIndices i k
|
||||
& hud . hudElement . diSelection . _Just . _2 %~ doswap
|
||||
& hud . diSelection . _Just . _2 %~ doswap
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
|
||||
swapItemWith ::
|
||||
@@ -182,7 +182,7 @@ swapItemWith f (j, i) = case j of
|
||||
|
||||
changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
|
||||
changeSwapWith f w
|
||||
| Just (j,i,_) <- w ^. hud . hudElement . diSelection = swapItemWith f (j,i) w
|
||||
| Just (j,i,_) <- w ^. hud . diSelection = swapItemWith f (j,i) w
|
||||
| otherwise = w
|
||||
|
||||
--changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
|
||||
@@ -195,7 +195,7 @@ changeSwapWith f w
|
||||
invSetSelection :: (Int, Int, IS.IntSet) -> World -> World
|
||||
invSetSelection sel w =
|
||||
w
|
||||
& hud . hudElement . diSelection ?~ sel
|
||||
& hud . diSelection ?~ sel
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
@@ -203,7 +203,7 @@ invSetSelection sel w =
|
||||
invSetSelectionPos :: Int -> Int -> World -> World
|
||||
invSetSelectionPos i j w =
|
||||
w
|
||||
& hud . hudElement . diSelection %~ f
|
||||
& hud . diSelection %~ f
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
@@ -215,7 +215,7 @@ scrollAugInvSel :: Int -> World -> World
|
||||
scrollAugInvSel yi w
|
||||
| yi == 0 = w
|
||||
| otherwise =
|
||||
w & hud . hudElement %~ doscroll
|
||||
w & hud %~ doscroll
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
@@ -226,7 +226,7 @@ scrollAugInvSel yi w
|
||||
|
||||
scrollAugNextInSection :: World -> World
|
||||
scrollAugNextInSection w =
|
||||
w & hud . hudElement %~ doscroll
|
||||
w & hud %~ doscroll
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
|
||||
Reference in New Issue
Block a user