Get rid of world hammers

This commit is contained in:
2023-01-16 01:52:12 +00:00
parent 43e3c1fe4c
commit 5810c2262a
9 changed files with 40 additions and 86 deletions
+9 -26
View File
@@ -2,10 +2,10 @@
module Dodge.Combine (
toggleCombineInv,
enterCombineInv,
combineListSelection,
picsToSelectable,
combineList,
) where
import SelectionIntMap
import Dodge.Data.Combine
import Dodge.Item.Display
import Color
@@ -108,29 +108,12 @@ toggleCombineInv w = case w ^. hud . hudElement of
_ -> w & enterCombineInv
enterCombineInv :: World -> World
enterCombineInv w = w & hud . hudElement . subInventory .~ CombineInventory
(combineListSelection w mi "" False)
enterCombineInv w = w & hud . hudElement . subInventory .~ CombineInventory sm
where
mi = 0 <$ listToMaybe (combineList w)
combineListSelection :: World -> Maybe Int -> String -> Bool -> SelectionIntMap CombinableItem
combineListSelection w mi regex x = SelectionIntMap
{ _smItems = combineList w
, _smSelPos = mi
, _smLength = length (combineList w)
, _smRegex = regex
, _smRegexInput = x
, _smShownItems = IM.fromAscList $ zip [0..] (combineList w)
}
picsToSelectable :: Int -> [String] -> SelectionItem ()
picsToSelectable wdth pics =
SelectionItem
{ _siPictures = pics
, _siHeight = length pics
, _siIsSelectable = True
, _siWidth = wdth
, _siColor = white
, _siOffX = 0
, _siPayload = ()
sm = initialSelPos $ SelectionIntMap
{ _smItems = combineList w
, _smSelPos = Nothing
, _smRegex = ""
, _smRegexInput = False
, _smShownItems = IM.fromAscList $ zip [0..] (combineList w)
}