Tweak cursor storage on sss
This commit is contained in:
+26
-26
@@ -114,29 +114,29 @@ toggleCombineInv uv = case uv ^? uvWorld . hud . hudElement . subInventory of
|
||||
Just CombineInventory{} -> uv & uvWorld . hud . hudElement . subInventory .~ NoSubInventory
|
||||
_ -> uv & uvWorld %~ enterCombineInv (uv ^. uvConfig)
|
||||
|
||||
updateCombineSelections :: World -> Configuration -> SelectionSections CombinableItem
|
||||
-> SelectionSections CombinableItem
|
||||
updateCombineSelections w cfig sss = sss & sssSections .~ updateSections availablelines ij [combs,filt]
|
||||
where
|
||||
availablelines = getAvailableListLines secondColumnParams cfig
|
||||
filt = (-1, (filtsec,filtitems))
|
||||
filtsec = fromMaybe defaultFiltSection $ sss ^? sssSections . ix (-1)
|
||||
filtitems = case w ^? hud . hudElement . subInventory . ciRegex . _Just of
|
||||
Just str -> IM.singleton 0 (SelectionRegex ["COMB. FILTER: " ++ str,numfiltitems] 2 True white 0)
|
||||
Nothing -> mempty
|
||||
numfiltitems = " " ++ show numfiltitems' ++ " FILTERED"
|
||||
numfiltitems' = length combitems' - length combitems
|
||||
combs :: (Int , (SelectionSection CombinableItem , IM.IntMap (SelectionItem CombinableItem)))
|
||||
combs = (0, (combsec,combitems))
|
||||
combsec = fromMaybe (defaultSS & ssDescriptor .~ "COMBINATIONS") $ sss ^? sssSections . ix 0
|
||||
combitems' = fromMaybe mempty $ w ^? hud . hudElement . subInventory . ciCombinations
|
||||
combitems = case w ^? hud . hudElement . subInventory . ciRegex . _Just of
|
||||
Just str -> IM.filter (regexList str . _siPictures) combitems'
|
||||
Nothing -> combitems'
|
||||
ij = fromMaybe (0,0) $ do
|
||||
i <- sss ^? sssSelPos . _Just
|
||||
j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
|
||||
return (i,j)
|
||||
--updateCombineSelections :: World -> Configuration -> SelectionSections CombinableItem
|
||||
-- -> SelectionSections CombinableItem
|
||||
--updateCombineSelections w cfig sss = sss & sssSections .~ updateSections availablelines ij [combs,filt]
|
||||
-- where
|
||||
-- availablelines = getAvailableListLines secondColumnParams cfig
|
||||
-- filt = (-1, (filtsec,filtitems))
|
||||
-- filtsec = fromMaybe defaultFiltSection $ sss ^? sssSections . ix (-1)
|
||||
-- filtitems = case w ^? hud . hudElement . subInventory . ciRegex . _Just of
|
||||
-- Just str -> IM.singleton 0 (SelectionRegex ["COMB. FILTER: " ++ str,numfiltitems] 2 True white 0)
|
||||
-- Nothing -> mempty
|
||||
-- numfiltitems = " " ++ show numfiltitems' ++ " FILTERED"
|
||||
-- numfiltitems' = length combitems' - length combitems
|
||||
-- combs :: (Int , (SelectionSection CombinableItem , IM.IntMap (SelectionItem CombinableItem)))
|
||||
-- combs = (0, (combsec,combitems))
|
||||
-- combsec = fromMaybe (defaultSS & ssDescriptor .~ "COMBINATIONS") $ sss ^? sssSections . ix 0
|
||||
-- combitems' = fromMaybe mempty $ w ^? hud . hudElement . subInventory . ciCombinations
|
||||
-- combitems = case w ^? hud . hudElement . subInventory . ciRegex . _Just of
|
||||
-- Just str -> IM.filter (regexList str . _siPictures) combitems'
|
||||
-- Nothing -> combitems'
|
||||
-- ij = fromMaybe (0,0) $ do
|
||||
-- i <- sss ^? sssSelPos . _Just
|
||||
-- j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
|
||||
-- return (i,j)
|
||||
|
||||
enterCombineInv :: Configuration -> World -> World
|
||||
enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory
|
||||
@@ -148,15 +148,15 @@ enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory
|
||||
cm = IM.fromAscList $ zip [0..] $ combineList w
|
||||
sss = SelectionSections
|
||||
{ _sssSections = IM.singleton 0 combsection
|
||||
, _sssSelPos = Just 0
|
||||
, _sssSelPos = Just (0,0)
|
||||
}
|
||||
availablelines = getAvailableListLines secondColumnParams cfig
|
||||
combsection = updateSection (Just 0) cm availablelines combinationssection'
|
||||
combsection = updateSection cm (Just 0) availablelines combinationssection'
|
||||
combinationssection' = SelectionSection
|
||||
{ _ssItems = cm
|
||||
, _ssCursor = do
|
||||
(i,si) <- IM.lookupMin cm
|
||||
return $ SectionCursor i 0 (length (_siPictures si)) (_siColor si)
|
||||
return $ SectionCursor 0 (length (_siPictures si)) (_siColor si)
|
||||
, _ssMinSize = 5
|
||||
, _ssOffset = 0
|
||||
, _ssShownItems = mempty
|
||||
|
||||
Reference in New Issue
Block a user