diff --git a/data/texture/charMap.png b/data/texture/charMap.png index 464c28b76..1732c7543 100644 Binary files a/data/texture/charMap.png and b/data/texture/charMap.png differ diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 8067d8cfd..afa85c7c8 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -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"