Commit before extending selection sections: overlapping elements
This commit is contained in:
@@ -53,14 +53,14 @@ updateCombineSections w cfig sss =
|
||||
invitms <- w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems
|
||||
return $ IM.filter (flip (andOrRegex $ regexCombs invitms) str) allcombs
|
||||
showncombs
|
||||
| null filtcombs = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
||||
| null filtcombs = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||
| otherwise = filtcombs
|
||||
filtinv = fromMaybe mempty $ do
|
||||
str <- mstr
|
||||
return $
|
||||
IM.singleton
|
||||
0
|
||||
(SelectionInfo ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
(SelectionInfo ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0 0)
|
||||
mstr = w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
|
||||
numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
|
||||
|
||||
@@ -105,7 +105,7 @@ updateDisplaySections w cfig sss =
|
||||
(filtinv, invx) = filtpair (-1) invitems' "INV. "
|
||||
(filtclose, closex) = filtpair 2 coitems' "NEARBY "
|
||||
youx = (1, youitems)
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
|
||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 0 ()
|
||||
thetext = displayFreeSlots nfreeslots
|
||||
availablelines = getAvailableListLines (invDisplayParams w) cfig
|
||||
coitems' =
|
||||
@@ -126,7 +126,7 @@ updateDisplaySections w cfig sss =
|
||||
return $
|
||||
IM.singleton
|
||||
0
|
||||
(SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
(SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0 0)
|
||||
itms' = fromMaybe itms $ do
|
||||
str <- mstr
|
||||
return $ IM.filter (plainRegex str) itms
|
||||
@@ -240,7 +240,7 @@ updateSection sis mcsel availablelines ss =
|
||||
++ [translate 0 100 . color moredowncolor . textVMirror $ theindent ++ replicate 15 '^']
|
||||
| otherwise = tweakfirst shownstrings
|
||||
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
|
||||
allstrings :: [(Color, String)]
|
||||
-- allstrings :: [(Color, String)]
|
||||
allstrings = foldMap g sis
|
||||
shownstrings = drop offset allstrings
|
||||
h (col, str) = color col . text $ theindent ++ str
|
||||
@@ -248,6 +248,21 @@ updateSection sis mcsel availablelines ss =
|
||||
--xtra str = color white . text $ theindent ++ str ++ " MORE " ++ _ssDescriptor ss
|
||||
g si = map (_siColor si,) $ _siPictures si
|
||||
|
||||
overlapSelectionItems :: [SelectionItem a] -> IM.IntMap (Picture, Color)
|
||||
overlapSelectionItems = go 0
|
||||
where
|
||||
go :: Int -> [SelectionItem a] -> IM.IntMap (Picture,Color)
|
||||
go _ [] = mempty
|
||||
go i (si : xs) = doinsert $ go (i + _siHeight si) xs
|
||||
where
|
||||
thecol = _siColor si
|
||||
doinsert m =
|
||||
ifoldr
|
||||
(\j str -> IM.insertWith ihelp (i + j + _siOffY si) (color thecol (text str), thecol))
|
||||
m
|
||||
(_siPictures si)
|
||||
ihelp (a,_) (b,col) = (a <> b, col)
|
||||
|
||||
enterCombineInv :: Configuration -> World -> World
|
||||
enterCombineInv cfig w =
|
||||
w & hud . hudElement . subInventory
|
||||
@@ -257,7 +272,7 @@ enterCombineInv cfig w =
|
||||
where
|
||||
cm' = IM.fromAscList $ zip [0 ..] $ combineList' w
|
||||
cm
|
||||
| null cm' = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
||||
| null cm' = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||
| otherwise = cm'
|
||||
sss =
|
||||
SelectionSections
|
||||
@@ -274,7 +289,7 @@ enterCombineInv cfig w =
|
||||
availablelines = getAvailableListLines secondColumnParams cfig
|
||||
filtsection =
|
||||
SelectionSection
|
||||
{ _ssItems = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
||||
{ _ssItems = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||
, _ssCursor = Nothing
|
||||
, _ssMinSize = 0
|
||||
, _ssOffset = 0
|
||||
|
||||
Reference in New Issue
Block a user