Reuse combine inventory code
This commit is contained in:
@@ -38,7 +38,6 @@ type IMSS a = IntMap (SelectionSection a)
|
|||||||
|
|
||||||
data SelectionWidth
|
data SelectionWidth
|
||||||
= FixedSelectionWidth Int
|
= FixedSelectionWidth Int
|
||||||
-- | UseMaxSelectionItemWidth
|
|
||||||
| UseItemWidth
|
| UseItemWidth
|
||||||
|
|
||||||
data SelectionItem a
|
data SelectionItem a
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ updateCombineSections w cfig =
|
|||||||
(const 0)
|
(const 0)
|
||||||
(w ^? hud . hudElement . subInventory . ciSelection . _Just)
|
(w ^? hud . hudElement . subInventory . ciSelection . _Just)
|
||||||
(getAvailableListLines secondColumnParams cfig)
|
(getAvailableListLines secondColumnParams cfig)
|
||||||
(IM.fromDistinctAscList [(0, sclose), (-1, sfclose)])
|
(IM.fromDistinctAscList [(-1, sfclose),(0, sclose')])
|
||||||
where
|
where
|
||||||
filtcurs = w ^? hud . hudElement . subInventory . ciSelection . _Just . _1 == Just (-1)
|
filtcurs = w ^? hud . hudElement . subInventory . ciSelection . _Just . _1 == Just (-1)
|
||||||
(sfclose, sclose) =
|
(sfclose, sclose) =
|
||||||
@@ -62,6 +62,11 @@ updateCombineSections w cfig =
|
|||||||
"COMBINATIONS"
|
"COMBINATIONS"
|
||||||
$ 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
|
||||||
|
sclose'
|
||||||
|
| null sclose =
|
||||||
|
IM.singleton 0 $
|
||||||
|
SelectionInfo ["No possible combinations"] 1 25 False white 0
|
||||||
|
| otherwise = sclose
|
||||||
|
|
||||||
regexCombs :: IM.IntMap Item -> SelectionItem CombinableItem -> String -> Bool
|
regexCombs :: IM.IntMap Item -> SelectionItem CombinableItem -> String -> Bool
|
||||||
regexCombs inv ci = \case
|
regexCombs inv ci = \case
|
||||||
@@ -318,10 +323,15 @@ enterCombineInv :: Configuration -> World -> World
|
|||||||
enterCombineInv cfig w =
|
enterCombineInv cfig w =
|
||||||
w & hud . hudElement . subInventory
|
w & hud . hudElement . subInventory
|
||||||
.~ CombineInventory
|
.~ CombineInventory
|
||||||
{ _ciSections = IM.fromDistinctAscList [(-1, filtsection), (0, combsection)]
|
{ _ciSections = updateCombineSections w cfig mempty
|
||||||
, _ciSelection = selpos
|
, _ciSelection = selpos
|
||||||
, _ciFilter = Nothing
|
, _ciFilter = Nothing
|
||||||
}
|
}
|
||||||
|
-- .~ CombineInventory
|
||||||
|
-- { _ciSections = IM.fromDistinctAscList [(-1, filtsection), (0, combsection)]
|
||||||
|
-- , _ciSelection = selpos
|
||||||
|
-- , _ciFilter = Nothing
|
||||||
|
-- }
|
||||||
& hud . hudElement . diInvFilter
|
& hud . hudElement . diInvFilter
|
||||||
.~ Nothing
|
.~ Nothing
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user