Add separate function checking when inventory is filtered
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.DisplayInventory (
|
||||
updateCombinePositioning,
|
||||
) where
|
||||
|
||||
import Data.Bifunctor
|
||||
import Dodge.Inventory
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -132,8 +133,13 @@ updateDisplaySections w cfig =
|
||||
map closeObjectToSelectionItem (w ^. hud . closeObjects)
|
||||
invitems =
|
||||
IM.mapWithKey
|
||||
(\k (y, x) -> invSelectionItem y cr k (x ^. locLDT . ldtValue))
|
||||
(allInvLocs $ _crInv cr)
|
||||
(\k (indent, x) -> invSelectionItem indent cr k (x ^. locLDT . ldtValue))
|
||||
(fmap (first removeindentiffiltering) . allInvLocs $ _crInv cr)
|
||||
-- this clearly deserves refactoring, also check if drawInventory/iextra
|
||||
-- needs it at the same time
|
||||
removeindentiffiltering = if maybe False isFilteringInv (w ^? hud . hudElement . diSections)
|
||||
then const 0
|
||||
else id
|
||||
cr = you w
|
||||
|
||||
-- filtpair i itms filtdescription mstr =
|
||||
|
||||
@@ -14,6 +14,7 @@ module Dodge.Inventory (
|
||||
module Dodge.Inventory.RBList,
|
||||
swapInvItems,
|
||||
scrollAugNextInSection,
|
||||
isFilteringInv,
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
@@ -254,3 +255,7 @@ selectedCloseObject w = do
|
||||
you w ^? crManipulation . manObject . ispCloseObject
|
||||
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . ix 3 . ssItems)
|
||||
w ^? hud . closeObjects . ix i
|
||||
|
||||
isFilteringInv :: IM.IntMap (SelectionSection a) -> Bool
|
||||
isFilteringInv = not . null . (^. ix (-1) . ssItems)
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ drawInventory sss w cfig =
|
||||
curs = invCursorParams w
|
||||
iextra = fromMaybe mempty $ do
|
||||
inv <- w ^? cWorld . lWorld . creatures . ix 0 . crInv
|
||||
guard =<< fmap (not . isFilteringInv) (w ^? hud . hudElement . diSections)
|
||||
return . inventoryExtra sss cfig w $ invAdj inv
|
||||
|
||||
drawRootCursor :: World
|
||||
|
||||
@@ -23,6 +23,7 @@ import qualified IntMapHelp as IM
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit u = [show $ u ^? uvWorld . hud . hudElement . diSelection . _Just
|
||||
, show $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
|
||||
, show . fmap (fmap _siPictures) $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems
|
||||
]
|
||||
-- <> [[toEnum (i+j * 32) | i <- [0..31]] | j <- [0..7]]
|
||||
-- <> map show (IM.elems (L.postscan (L.premap _siHeight L.sum)
|
||||
|
||||
@@ -15,7 +15,6 @@ doTextInputOverUniverse p u = doTextInputOver (u ^. uvWorld . input) p u
|
||||
doTextInputOver :: Input -> ASetter' a String -> a -> a
|
||||
doTextInputOver u p x =
|
||||
x & p %~ (++ map toUpper (rights str))
|
||||
--x & p %~ (++ rights str)
|
||||
& checkBackspace
|
||||
where
|
||||
str = u ^. textInput
|
||||
|
||||
Reference in New Issue
Block a user