Remove invTrees function

This commit is contained in:
2024-11-29 20:47:16 +00:00
parent de4a955206
commit 59c65b059a
3 changed files with 5 additions and 33 deletions
-15
View File
@@ -1,6 +1,5 @@
module Dodge.Item.Grammar (
invLDT,
invTrees,
invAdj,
invRootMap,
invRootTrees,
@@ -9,7 +8,6 @@ module Dodge.Item.Grammar (
) where
import Control.Applicative
import Data.Bifunctor
import qualified Data.IntMap.Strict as IM
import Data.Maybe
import Dodge.Data.ComposedItem
@@ -205,19 +203,6 @@ invAdj = IM.unions . map g . invLDT
(error ("invAdj item " ++ show (_itID itm) ++ " location: " ++ show (itm ^? itLocation)))
$ itm ^? itLocation . ilInvID
-- returns an intmap with trees for all items
invTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ComposeLinkType Item)
invTrees = fmap (first _iatType) . invTrees'
-- returns an intmap with trees for all items
invTrees' :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink Item)
--invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x, y, _) -> (x, y))) . invLDT
invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . invLDT
where
getindex i =
fromMaybe (error "in invTrees try to get non-inventory item tree") $
i ^? itLocation . ilInvID
-- returns an intmap with trees for (only!) root items, indexed by inventory position
invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem)
invRootTrees = IM.fromDistinctAscList . reverse . map getid . invLDT