Cleanup
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
-- {-# OPTIONS_GHC -fno-full-laziness #-}
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
--{-# LANGUAGE BangPatterns #-}
|
||||
|
||||
module Dodge.DisplayInventory (
|
||||
@@ -10,9 +9,6 @@ module Dodge.DisplayInventory (
|
||||
toggleCombineInv,
|
||||
) where
|
||||
|
||||
--import StrictHelp
|
||||
|
||||
--import qualified Data.Strict.Tuple as STup
|
||||
import Control.Applicative
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -67,18 +63,12 @@ updateCombineSections w cfig =
|
||||
$ w ^? hud . hudElement . subInventory . ciFilter . _Just
|
||||
invitms = fold $ w ^? cWorld . lWorld . creatures . ix 0 . crInv
|
||||
|
||||
--regexCombs :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool
|
||||
regexCombs :: IM.IntMap Item -> SelectionItem CombinableItem -> String -> Bool
|
||||
regexCombs inv ci = \case
|
||||
'<' : str -> f str
|
||||
'<' : str -> any (g str) (_ciInvIDs $ _siPayload ci)
|
||||
str -> (regexList str . _siPictures) ci
|
||||
where
|
||||
f str = any (g str) (_ciInvIDs $ _siPayload ci)
|
||||
g str i = fromMaybe False $ do
|
||||
si <- inv ^? ix i
|
||||
return $ regexList str $ basicItemDisplay si
|
||||
|
||||
--return $ regexList str $ _siPictures si
|
||||
g str i = maybe False (regexList str . basicItemDisplay) (inv ^? ix i)
|
||||
|
||||
andOrRegex :: (a -> String -> Bool) -> a -> String -> Bool
|
||||
andOrRegex f x = all (orRegex f x) . List.wordsBy '&'
|
||||
@@ -133,7 +123,8 @@ updateDisplaySections w cfig =
|
||||
[-1 .. 5]
|
||||
[ invhead
|
||||
, sinv
|
||||
, IM.singleton 0 $ SelectionItem [displayFreeSlots (crNumFreeSlots cr)] 1 15 True invDimColor 2 ()
|
||||
, IM.singleton 0
|
||||
$ SelectionItem [displayFreeSlots (crNumFreeSlots cr)] 1 15 True invDimColor 2 ()
|
||||
, nearbyhead
|
||||
, sclose
|
||||
, interfaceshead
|
||||
@@ -167,12 +158,6 @@ updateDisplaySections w cfig =
|
||||
(uncurry (invSelectionItem w))
|
||||
(allInvLocs $ _crInv cr)
|
||||
|
||||
-- (fmap (first removeindentiffiltering) . allInvLocs $ _crInv cr)
|
||||
-- removeindentiffiltering =
|
||||
-- if maybe False (not . null) (w ^? hud . hudElement . diInvFilter . _Just)
|
||||
-- then const 0
|
||||
-- else id
|
||||
|
||||
filterSectionsPair ::
|
||||
Bool -> -- check for whether filter is in focus, changes string at the end
|
||||
(String -> SelectionItem a -> Bool) ->
|
||||
@@ -253,7 +238,6 @@ updateSectionsPositioning ::
|
||||
(Int -> Int) -> -- for determining each sections indent
|
||||
Maybe (Int, Int, IntSet) ->
|
||||
Int ->
|
||||
--[(Int, IM.IntMap (SelectionItem a))] ->
|
||||
IM.IntMap (IM.IntMap (SelectionItem a)) ->
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
IM.IntMap (SelectionSection a)
|
||||
@@ -307,10 +291,6 @@ updateSection indent mcsel sis availablelines oldoffset =
|
||||
tweakfirst
|
||||
| offset > 0 = ix 0 .~ color white (text (replicate 15 (toEnum 30)))
|
||||
| otherwise = id
|
||||
-- tweakfirst (x:xs)
|
||||
-- | offset > 0 = color white (text (replicate 15 (toEnum 30))) : xs
|
||||
-- | otherwise = (x:xs)
|
||||
-- tweakfirst [] = []
|
||||
tweaklast
|
||||
| aslength - offset > availablelines =
|
||||
ix (availablelines - 1)
|
||||
@@ -326,7 +306,7 @@ listSelectionColorPicture si = (g <$> _siPictures si, Sum $ _siHeight si)
|
||||
lindent = 100 * fromIntegral (_siOffX si)
|
||||
|
||||
regexList :: String -> [String] -> Bool
|
||||
regexList x = any (List.isInfixOf x)
|
||||
regexList = any . List.isInfixOf
|
||||
|
||||
toggleCombineInv :: Universe -> Universe
|
||||
toggleCombineInv uv =
|
||||
|
||||
Reference in New Issue
Block a user