From aca7ebd808c99106c8f4bfe3ac4a503db92948be Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 24 Nov 2024 09:47:32 +0000 Subject: [PATCH] Cleanup --- ghcidOutput | 31 ------------------------------- src/Dodge/DisplayInventory.hs | 32 ++++---------------------------- 2 files changed, 4 insertions(+), 59 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 96e9d85a1..5eb8f3a6c 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1,34 +1,3 @@ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:116:1-20: warning: [GHC-38417] [-Wmissing-signatures] - Top-level binding with no type signature: - displaySectionsSizes :: (Eq a1, Num a1, Num a2) => a1 -> a2 - | -116 | displaySectionsSizes 0 = 10 - | ^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:260:27: warning: [-Wunused-matches] - Defined but not used: ‘f’ - | -260 | updateSectionsPositioning f mselpos allavailablelines lsss sss = - | ^ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:270:5: warning: [-Wunused-local-binds] - Defined but not used: ‘g’ - | -270 | g k x z = x - | ^ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:270:7: warning: [-Wunused-matches] - Defined but not used: ‘k’ - | -270 | g k x z = x - | ^ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:270:11: warning: [-Wunused-matches] - Defined but not used: ‘z’ - | -270 | g k x z = x - | ^ -/home/justin/Haskell/loop/src/Dodge/DisplayInventory.hs:282:1-26: warning: [-Wunused-top-binds] - Defined but not used: ‘updateSectionsPositioning'’ - | -282 | updateSectionsPositioning' f mselpos allavailablelines lsss sss = fromMaybe mempty $ do - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ /home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:128:9-18: warning: [-Wunused-local-binds] Defined but not used: ‘nfreeslots’ | diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 2cf52e963..cb0f28d6d 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -51,7 +51,7 @@ updateCombineSections :: IM.IntMap (SelectionSection CombinableItem) updateCombineSections w cfig = updateSectionsPositioning - (const 0) + (const 5) (w ^? hud . hudElement . subInventory . ciSelection . _Just) (getAvailableListLines secondColumnParams cfig) [(0, sclose), (-1, sfclose)] @@ -113,9 +113,10 @@ checkCombineSelectionExists u = fromMaybe u $ do %~ scrollSelectionSections (-1) sss _ -> u +displaySectionsSizes :: Int -> Int displaySectionsSizes 0 = 10 displaySectionsSizes 3 = 10 -displaySectionsSizes _ = 2 +displaySectionsSizes _ = 3 updateDisplaySections :: World -> @@ -223,7 +224,6 @@ sectionsSizes :: sectionsSizes x f is sss = doSectionSize extraavailable mintaken is sss mempty where mintaken = IM.mapWithKey (\k y -> min (f k) y) sss - --mintaken = IM.mapWithKey (\k y -> f k) sss extraavailable = x - sum mintaken doSectionSize :: @@ -267,34 +267,10 @@ updateSectionsPositioning f mselpos allavailablelines lsss sss = return i ls = IM.fromList lsss h = IM.intersectionWith ($) - g k x z = x lk = fromMaybe [] $ fmap ((:[]) . fst) mselpos - ssizes = sectionsSizes allavailablelines displaySectionsSizes + ssizes = sectionsSizes allavailablelines f lk $ sectionsDesiredLines $ IM.intersectionWith (set ssItems) ls sss -updateSectionsPositioning' :: - (Int -> Int) -> -- for determining each sections minimum size - Maybe (Int, Int) -> - Int -> - [(Int, IM.IntMap (SelectionItem a))] -> - IM.IntMap (SelectionSection a) -> - IM.IntMap (SelectionSection a) -updateSectionsPositioning' f mselpos allavailablelines lsss sss = fromMaybe mempty $ do - ((k, y) , xs) <- List.uncons lsss - x <- sss ^? ix k - let mscel = do - (i, j) <- mselpos - guard $ i == k - return j - let availablelines = allavailablelines - min (f k) (length $ _ssShownItems x) - let previoussections = updateSectionsPositioning f mselpos availablelines xs sss --- let linestaken (k',ss') = max (length $ _ssShownItems ss') (f k') --- let linesleft = allavailablelines - sum (linestaken <$> IM.toList $ previoussections) - let linestaken = length . _ssShownItems - let linesleft = allavailablelines - sum (linestaken <$> previoussections) - let ss = updateSection y mscel linesleft x - return $ IM.insert k ss previoussections - updateSection :: IM.IntMap (SelectionItem a) -> Maybe Int ->