Continue inventory work

This commit is contained in:
2023-02-17 18:37:55 +00:00
parent 90133fb54b
commit 90370e5487
4 changed files with 20 additions and 56 deletions
+7 -6
View File
@@ -50,7 +50,8 @@ updateDisplayInventory w cfig sss = case cr ^? crManipulation . manObject of
Just str -> IM.singleton 0 (SelectionRegex ["INV. FILTER: " ++ str,numfiltitems] 2 True white 0)
Nothing -> mempty
filtclose = (2,(filtclosesec,filtcloseitems))
filtclosesec = fromMaybe defaultFiltSection $ sss ^? sssSections . ix 2
filtclosesec = fromMaybe (defaultFiltSection & ssIndent .~ 2)
$ sss ^? sssSections . ix 2
filtcloseitems = case cr ^? crManipulation . closeRegex . _Just of
Just str -> IM.singleton 0 (SelectionRegex ["NEARBY FILTER: " ++ str,numfiltclose] 2 True white 0)
Nothing -> mempty
@@ -67,7 +68,7 @@ updateDisplayInventory w cfig sss = case cr ^? crManipulation . manObject of
cosec = fromMaybe defaultCOSection $ sss ^? sssSections . ix 2
invsec = fromMaybe defaultInvSection $ sss ^? sssSections . ix 0
coitems' = IM.fromDistinctAscList . zip [0..]
$ map (closeObjectToSelectionItem nfreeslots) (w ^. hud . closeObjects)
$ map closeObjectToSelectionItem (w ^. hud . closeObjects)
coitems = case cr ^? crManipulation . closeRegex . _Just of
Just str -> IM.filter (regexList str . _siPictures) coitems'
Nothing -> coitems'
@@ -81,9 +82,9 @@ updateDisplayInventory w cfig sss = case cr ^? crManipulation . manObject of
displayFreeSlots :: Int -> String
displayFreeSlots x = case x of
0 -> " INVENTORY FULL"
1 -> " +1 FREE SLOT"
_ -> " +" ++ show x ++ " FREE SLOTS"
0 -> "INVENTORY FULL"
1 -> "1 FREE SLOT"
_ -> show x ++ " FREE SLOTS"
updateSections :: Int -> (Int, Int) -> [(Int,(SelectionSection a,IM.IntMap (SelectionItem a)))]
-> IM.IntMap (SelectionSection a)
@@ -169,7 +170,7 @@ updateSection mspos sis' availablelines ss = ss
allstrings = foldMap g sis
mustrestrict = length allstrings > availablelines
shownstrings = drop offset allstrings
h (col,str) = color col . text $ str
h (col,str) = color col . text $ theindent ++ str
theindent = replicate (_ssIndent ss) ' '
hdown = color white . text $ theindent ++ ">>> MORE " ++ _ssDescriptor ss
hup = color white . text $ theindent ++ "<<< MORE " ++ _ssDescriptor ss