Move combine list over to SelectionSections -- more todo

This commit is contained in:
2023-02-18 10:59:59 +00:00
parent 36b9b5445c
commit 6eca3bab38
10 changed files with 119 additions and 160 deletions
+14 -10
View File
@@ -30,8 +30,8 @@ updateUsingInput w = case w ^. hud . hudElement of
pressedMBEffects :: SubInventory -> M.Map MouseButton Bool -> World -> World
pressedMBEffects subinv pkeys w = case subinv of
NoSubInventory -> pressedMBEffectsNoInventory pkeys w
CombineInventory SelectionIntMap{_smSelPos = mi}
| lbinitialpress -> maybeexitcombine (maybe id doCombine mi w)
CombineInventory _ _ sss
| lbinitialpress -> tryCombine sss w -- maybeexitcombine (maybe id doCombine mi w)
DisplayTerminal tmid
| lbinitialpress && inTermFocus w ->
doTerminalEffectLB (w ^?! cWorld . lWorld . terminals . ix tmid) w
@@ -40,11 +40,14 @@ pressedMBEffects subinv pkeys w = case subinv of
_ -> w
where
lbinitialpress = pkeys ^? ix ButtonLeft == Just False
maybeexitcombine w'
| ButtonRight `M.member` _mouseButtons (_input w) =
(hud . hudElement . subInventory . subInvMap %~ setShownIntMap) $
(hud . hudElement . subInventory . subInvMap . smItems .~ combineList w') w'
| otherwise = w' & hud . hudElement . subInventory .~ NoSubInventory
-- maybeexitcombine w'
-- | ButtonRight `M.member` _mouseButtons (_input w) =
-- (hud . hudElement . subInventory . subInvMap %~ setShownIntMap) $
-- (hud . hudElement . subInventory . subInvMap . smItems .~ combineList w') w'
-- | otherwise = w' & hud . hudElement . subInventory .~ NoSubInventory
tryCombine :: SelectionSections CombinableItem -> World -> World
tryCombine sss w = w
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
pressedMBEffectsNoInventory pkeys w
@@ -64,9 +67,10 @@ pressedMBEffectsNoInventory pkeys w
-- note "sort" on the inventory indices; otherwise
-- lower items may be shifted up and items below these removed instead
doCombine :: Int -> World -> World
doCombine i w = case w ^? hud . hudElement . subInventory . subInvMap . smShownItems . ix i . siPayload of
Nothing -> w
Just (CombinableItem is it _) -> createAndSelectItem it $ foldr (rmInvItem 0) w (sort is)
doCombine i w = undefined
-- case w ^? hud . hudElement . subInventory . subInvMap . smShownItems . ix i . siPayload of
-- Nothing -> w
-- Just (CombinableItem is it _) -> createAndSelectItem it $ foldr (rmInvItem 0) w (sort is)
updatePressedButtonsCarte :: M.Map MouseButton Bool -> World -> World
updatePressedButtonsCarte pkeys w