Cleanup
This commit is contained in:
@@ -8,13 +8,13 @@ module Dodge.DisplayInventory (
|
|||||||
toggleCombineInv,
|
toggleCombineInv,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.IntSet (IntSet)
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.IntMap.Merge.Strict
|
import Data.IntMap.Merge.Strict
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
import Data.IntSet (IntSet)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Dodge.Base.You
|
import Dodge.Base.You
|
||||||
@@ -86,28 +86,26 @@ updateInventoryPositioning :: Universe -> Universe
|
|||||||
updateInventoryPositioning u =
|
updateInventoryPositioning u =
|
||||||
u & uvWorld . hud . hudElement . diSections
|
u & uvWorld . hud . hudElement . diSections
|
||||||
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
|
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
|
||||||
& checkInventorySelectionExists
|
& uvWorld
|
||||||
|
%~ checkInventorySelectionExists
|
||||||
|
|
||||||
checkInventorySelectionExists :: Universe -> Universe
|
checkInventorySelectionExists :: World -> World
|
||||||
checkInventorySelectionExists u =
|
checkInventorySelectionExists w =
|
||||||
case u ^? uvWorld . hud . hudElement . diSections . ix i . ssItems . ix j of
|
case w ^? hud . hudElement . diSections . ix i . ssItems . ix j of
|
||||||
Nothing -> u & uvWorld %~ scrollAugNextInSection
|
Nothing -> scrollAugNextInSection w
|
||||||
_ -> u
|
_ -> w
|
||||||
where
|
where
|
||||||
(i, j, _) =
|
(i, j, _) = fromMaybe (1, -1, mempty) $ w ^? hud . hudElement . diSelection . _Just
|
||||||
fromMaybe (1, -1, mempty) $
|
|
||||||
u ^? uvWorld . hud . hudElement . diSelection . _Just
|
|
||||||
|
|
||||||
checkCombineSelectionExists :: SubInventory -> SubInventory
|
checkCombineSelectionExists :: SubInventory -> SubInventory
|
||||||
checkCombineSelectionExists u = fromMaybe u $ do
|
checkCombineSelectionExists si
|
||||||
sss <- u ^? ciSections
|
| Just sss <- si ^? ciSections
|
||||||
(i, j, _) <- u ^? ciSelection . _Just <|> Just (0, 0, mempty)
|
, Just (i, j, _) <- si ^? ciSelection . _Just <|> Just (0, 0, mempty)
|
||||||
Just $ case u ^? ciSections . ix i . ssItems . ix j of
|
, isNothing $ si ^? ciSections . ix i . ssItems . ix j =
|
||||||
Nothing ->
|
si & ciSelection ?~ (0, -1, mempty)
|
||||||
u & ciSelection ?~ (0, -1, mempty)
|
& ciSelection
|
||||||
& ciSelection
|
%~ scrollSelectionSections (-1) sss
|
||||||
%~ scrollSelectionSections (-1) sss
|
| otherwise = si
|
||||||
_ -> u
|
|
||||||
|
|
||||||
displaySectionsSizes :: Int -> Int
|
displaySectionsSizes :: Int -> Int
|
||||||
displaySectionsSizes 0 = 10
|
displaySectionsSizes 0 = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user