Tweak characters

This commit is contained in:
2023-02-22 13:25:54 +00:00
parent ecbf074bf4
commit e566d89349
2 changed files with 10 additions and 9 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

+10 -9
View File
@@ -53,9 +53,7 @@ updateCombineInventory w cfig sss =
filtcombs = fromMaybe allcombs $ do
str <- mstr
invitms <- w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems
--return $ IM.filter (regexList str . _siPictures) allcombs
return $ IM.filter (flip (andOrRegex $ regexCombs' invitms) str) allcombs
--return $ regexCombs invitms str allcombs
return $ IM.filter (flip (andOrRegex $ regexCombs invitms) str) allcombs
showncombs
| null filtcombs = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
| otherwise = filtcombs
@@ -68,8 +66,8 @@ updateCombineInventory w cfig sss =
mstr = w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
regexCombs' :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool
regexCombs' inv ci str = case str of
regexCombs :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool
regexCombs inv ci str = case str of
'<':str' -> f str' ci
_ -> (regexList str . _siPictures) ci
where
@@ -82,9 +80,9 @@ andOrRegex :: (a -> String -> Bool) -> a -> String -> Bool
andOrRegex f x str = all (orRegex f x) (wordsBy '&' str)
orRegex :: (a -> String -> Bool) -> a -> String -> Bool
orRegex _ _ [] = True
orRegex f x str = any (f x) (words str)
orRegex f x str = case words str of
[] -> True
xs -> any (f x) xs
updateDisplayInventory :: World -> Configuration -> SelectionSections () -> SelectionSections ()
updateDisplayInventory w cfig sss =
@@ -128,9 +126,12 @@ updateDisplayInventory w cfig sss =
(SelectionRegex [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
itms' = fromMaybe itms $ do
str <- mstr
return $ IM.filter (regexList str . _siPictures) itms
return $ IM.filter (plainRegex str) itms
numfiltitems = " " ++ show (length itms - length itms') ++ " FILTERED"
plainRegex :: String -> SelectionItem a -> Bool
plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si))
displayFreeSlots :: Int -> String
displayFreeSlots x = case x of
0 -> "INVENTORY FULL"