Rewrite of item color in inventory, runs slowly

This commit is contained in:
2024-10-06 12:55:18 +01:00
parent 9860a88c0c
commit 597e8dd89d
8 changed files with 139 additions and 98 deletions
+9 -5
View File
@@ -9,6 +9,8 @@ module Dodge.DisplayInventory (
updateCombinePositioning,
) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Control.Lens
import Dodge.Inventory.SelectionList
import Control.Monad
@@ -113,11 +115,10 @@ updateDisplaySections w cfig sss =
coitems' =
IM.fromDistinctAscList . zip [0 ..] $
map closeObjectToSelectionItem (w ^. hud . closeObjects)
invitems' = IM.mapWithKey (\k (x,y,_) -> invSelectionItem cr k x y) inv
invitems' = IM.mapWithKey (\k (y,x) -> invSelectionItem cr k (x ^. locLDT . ldtValue) y)
invlocs
cr = you w
inv = invIndentIM $ _crInv (you w)
--indents = indentInv inv
--inv = indentInv $ _crInv (you w)
invlocs = invTrees'' $ _crInv (you w)
nfreeslots = crNumFreeSlots cr
filtpair i itms filtdescription =
( (i, filtsis)
@@ -147,7 +148,10 @@ updateInventorySectionItems w =
where
f olditems = fromMaybe olditems $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
--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