From da5a895f24319400f01ed8404ce593f019077738 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 8 Oct 2024 10:47:31 +0100 Subject: [PATCH] Cleanup --- ghcidOutput | 2 +- src/Dodge/DisplayInventory.hs | 9 +++---- src/Dodge/Item/Grammar.hs | 3 ++- src/Dodge/Luse.hs | 51 +++++++++++++++++------------------ 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 98e3a30b4..2e6e0890d 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (597 modules, at 10:20:30) +All good (597 modules, at 10:47:27) diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 2d868840a..5a8d284b2 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -236,8 +236,7 @@ listSelectionColorPicture = foldMap f g str = (_siColor si,translate indent 0 . color (_siColor si) $ text str) enterCombineInv :: Configuration -> World -> World -enterCombineInv cfig w = - w & hud . hudElement . subInventory .~ CombineInventory sss +enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory sss where cm' = IM.fromDistinctAscList . zip [0 ..] $ combineList w cm @@ -258,7 +257,7 @@ enterCombineInv cfig w = availablelines = getAvailableListLines secondColumnParams cfig filtsection = SelectionSection - { _ssItems = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 + { _ssItems = mempty , _ssCursor = Nothing , _ssMinSize = 0 , _ssOffset = 0 @@ -266,9 +265,7 @@ enterCombineInv cfig w = , _ssIndent = 0 , _ssDescriptor = "COMB FILTER" } - combsection = updateSection cm (Just 0) availablelines combinationssection' - combinationssection' = - SelectionSection + combsection = updateSection cm (Just 0) availablelines SelectionSection { _ssItems = cm , _ssCursor = do (_, si) <- IM.lookupMin cm diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index bf121df97..852cb44cb 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -22,7 +22,8 @@ import Dodge.Item.Orientation import LensHelp import ListHelp -useBreakL :: [(ItemStructuralFunction, ComposeLinkType)] -> [(ItemStructuralFunction, ComposeLinkType)] +useBreakL :: [(ItemStructuralFunction, ComposeLinkType)] + -> [(ItemStructuralFunction, ComposeLinkType)] -> LinkTest useBreakL x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y) where diff --git a/src/Dodge/Luse.hs b/src/Dodge/Luse.hs index c0fd2a9aa..91852579a 100644 --- a/src/Dodge/Luse.hs +++ b/src/Dodge/Luse.hs @@ -1,18 +1,15 @@ -module Dodge.Luse - ( useL - ) - where +{-# LANGUAGE LambdaCase #-} +module Dodge.Luse ( + useL, +) where ---import Dodge.Base import Dodge.Creature.Action import Dodge.Data.World import Dodge.Item.Weapon.TriggerType ---import Geometry ---import qualified IntMapHelp as IM import LensHelp useL :: Luse -> Item -> Creature -> World -> World -useL lu = case lu of +useL = \case LDoNothing -> const $ const id LRewind -> useRewindGun LTimePause -> hammerCheckL useStopWatch @@ -22,28 +19,30 @@ useL lu = case lu of LBoost -> boostSelfL 10 useStopWatch :: Item -> Creature -> World -> World -useStopWatch itm _ w = w - & timeFlow .~ PausedTimeFlow - { _timeFlowCharge = itm ^?! itUse . leftConsumption . wpCharge - , _scrollItemID = _itID itm - } - +useStopWatch itm _ = + timeFlow + .~ PausedTimeFlow + { _timeFlowCharge = itm ^?! itUse . leftConsumption . wpCharge + , _scrollItemID = _itID itm + } useTimeScrollGun :: Item -> Creature -> World -> World -useTimeScrollGun itm _ w = w & timeFlow .~ ItemScrollTimeFlow - { _scrollSmoothing = 0 - , _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge - , _futureWorlds = [] - , _scrollItemID = _itID itm - } - +useTimeScrollGun itm _ = + timeFlow + .~ ItemScrollTimeFlow + { _scrollSmoothing = 0 + , _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge + , _futureWorlds = [] + , _scrollItemID = _itID itm + } useRewindGun :: Item -> Creature -> World -> World -useRewindGun itm _ w = w - & timeFlow .~ RewindLeftClick - { _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge - , _scrollItemID = _itID itm - } +useRewindGun itm _ = + timeFlow + .~ RewindLeftClick + { _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge + , _scrollItemID = _itID itm + } --useRewindGun _ _ w = case w ^. cwTime . rewindWorlds of -- [w'] -> w & cwTime . maybeWorld .~ Just' w'