Cleanup, remove inventory display update code on dropping item

This commit is contained in:
2024-10-06 22:32:10 +01:00
parent 650854d13e
commit 507c8e9819
7 changed files with 64 additions and 77 deletions
+17 -17
View File
@@ -4,7 +4,7 @@
module Dodge.DisplayInventory (
toggleCombineInv,
updateInventorySectionItems,
-- updateInventorySectionItems,
updateInventoryPositioning,
updateCombinePositioning,
) where
@@ -117,7 +117,7 @@ updateDisplaySections w cfig sss =
invitems' = IM.mapWithKey (\k (y,x) -> invSelectionItem cr k (x ^. locLDT . ldtValue) y)
invlocs
cr = you w
invlocs = invTrees'' $ _crInv (you w)
invlocs = allInvLocs $ _crInv (you w)
nfreeslots = crNumFreeSlots cr
filtpair i itms filtdescription =
( (i, filtsis)
@@ -139,21 +139,21 @@ updateDisplaySections w cfig sss =
invDimColor :: Color
invDimColor = greyN 0.7
-- this appears to be only for filtering
updateInventorySectionItems :: World -> World
updateInventorySectionItems w =
w
& hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f
where
f olditems = fromMaybe olditems $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
--invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
let invitms = IM.mapWithKey (invSelectionItem' cr)
$ fmap (^. _2 . locLDT . ldtValue)
$ invTrees'' $ cr ^. crInv
return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
Just str -> IM.filter (plainRegex str) invitms
_ -> invitms
---- this appears to be only for filtering
--updateInventorySectionItems :: World -> World
--updateInventorySectionItems w =
-- w
-- & hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f
-- where
-- cr = w ^?! cWorld . lWorld . creatures . ix 0
-- invitms = IM.mapWithKey (invSelectionItem' cr)
-- $ fmap (^. _2 . locLDT . ldtValue)
-- $ allInvLocs $ cr ^. crInv
-- f olditems = fromMaybe olditems $ do
-- --invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
-- return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
-- Just str -> IM.filter (plainRegex str) invitms
-- _ -> invitms
plainRegex :: String -> SelectionItem a -> Bool
plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si))