Cleanup
This commit is contained in:
-31
@@ -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’
|
||||
|
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user