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