Slightly rethink display of inventories and terminals

This commit is contained in:
2025-09-18 19:56:12 +01:00
parent e017a92892
commit 2d856ddf9e
13 changed files with 156 additions and 139 deletions
+21 -11
View File
@@ -61,13 +61,13 @@ updateCombineSections w cfig =
filtcurs
(flip . andOrRegex $ regexCombs invitms)
(IM.fromDistinctAscList . zip [0 ..] $ combineList w)
"COMBINATIONS"
"POSSIBLE COMBINATIONS"
$ w ^? hud . subInventory . ciFilter . _Just
invitms = _unNIntMap $ fmap (\k -> w ^?! cWorld . lWorld . items . ix k) $ fold $ w ^? cWorld . lWorld . creatures . ix 0 . crInv
sclose'
| null sclose =
IM.singleton 0 $
SelItem ["No possible combinations"] 1 25 False white 0 Nothing
SelItem ["NONE"] 1 25 False white 0 Nothing
| otherwise = sclose
regexCombs :: IM.IntMap Item -> SelectionItem CombinableItem -> String -> Bool
@@ -169,24 +169,34 @@ filterSectionsPair ::
String ->
Maybe String ->
(IM.IntMap (SelectionItem a), IM.IntMap (SelectionItem a))
filterSectionsPair infocus filtfn itms filtdescription mfilt = (filtsis, itms')
filterSectionsPair infocus filtfn itms s mfilt = (x, itms')
where
filtcurs = if infocus then cFilledRect else cWireRect
filtsis = fold $ do
x = IM.singleton 0 $ fromMaybe (SelItem [s] 1 (length s) False white 0 Nothing) $ do
str <- mfilt
return $
IM.singleton
0
$ SelItem
[filtdescription ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
return $ SelItem
[s ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
2
(length (filtdescription ++ " FILTER/" ++ str ++ [filtcurs]))
(length (s ++ " FILTER/" ++ str ++ [filtcurs]))
True
white
0
Nothing
-- filtsis = fold $ do
-- str <- mfilt
-- return $
-- IM.singleton
-- 0
-- $ SelItem
-- [filtdescription ++ " FILTER/" ++ str ++ [filtcurs], numfiltitems]
-- 2
-- (length (filtdescription ++ " FILTER/" ++ str ++ [filtcurs]))
-- True
-- white
-- 0
-- Nothing
itms' = maybe id (IM.filter . filtfn) mfilt itms
numfiltitems = " " ++ show (length itms - length itms') ++ " FILTERED"
numfiltitems = show (length itms - length itms') ++ " FILTERED"
invDimColor :: Color
invDimColor = greyN 0.7