From f1d4f530d90c18fbc340750d67d374961531dd24 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 12 Jul 2025 22:04:50 +0100 Subject: [PATCH] Cleanup --- src/Dodge/Item/Grammar.hs | 64 +-------------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index 45ba29013..36f7f6dcf 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -199,19 +199,11 @@ joinItemsInList f = fst . h . ([],) Just w -> h ( zs,w : ys) -- this puts the first elements in the intmap at the end of the list ---invLDT :: IM.IntMap Item -> [LDTree ItemLink CItem] ---invLDT = --- joinItemsInList tryAttachItems . IM.elems --- . fmap (singleLDT . baseCI) - invDT :: IM.IntMap Item -> [DTree CItem] invDT = joinItemsInList tryAttachItems . IM.elems . fmap (singleDT . baseCI) ---invLDT' :: IM.IntMap Item -> [LDTree ItemLink OItem] ---invLDT' = fmap propagateOrientation . invLDT - invDT' :: IM.IntMap Item -> [DTree OItem] invDT' = fmap propagateOrientation' . invDT @@ -240,24 +232,13 @@ invAdj = IM.unions . map g . invDT $ itm ^? itLocation . ilInvID ---- returns an intmap with trees for (only!) root items, indexed by inventory position ---invRootTrees :: IM.IntMap Item -> IM.IntMap (LDTree ItemLink OItem) ---invRootTrees = fmap propagateOrientation . IM.fromDistinctAscList . reverse . map getid . invLDT --- where --- getid :: LDTree ItemLink CItem -> (Int, LDTree ItemLink CItem) --- getid t = (t ^?! ldtValue . _1 . itLocation . ilInvID, t) - invIMDT :: IM.IntMap Item -> IM.IntMap (DTree OItem) invIMDT = fmap propagateOrientation' . IM.fromDistinctAscList . reverse . map getid . invDT where getid :: DTree CItem -> (Int, DTree CItem) getid t = (t ^?! dtValue . _1 . itLocation . ilInvID, t) ---invRootTrees' :: IM.IntMap Item -> IM.IntMap (LDTree ItemLink CItem) ---invRootTrees' = IM.fromDistinctAscList . reverse . map getid . invLDT --- where --- getid :: LDTree ItemLink CItem -> (Int, LDTree ItemLink CItem) --- getid t = (t ^?! ldtValue . _1 . itLocation . ilInvID, t) - +---- returns an intmap with indents and locations for all items invIndents :: IM.IntMap Item -> IM.IntMap (Int, LocationDT OItem) invIndents inv = foldMap (f . LocDT TopDT) (IM.elems (invIMDT inv)) mempty where @@ -277,46 +258,3 @@ invIndents inv = foldMap (f . LocDT TopDT) (IM.elems (invIMDT inv)) mempty (ldt ^?! locDT . dtValue . _1 . itLocation . ilInvID) (x, ldt) ) - - ----- returns an intmap with indents and locations for all items ---allInvLocs :: IM.IntMap Item -> IM.IntMap (Int, LocationLDT ItemLink OItem) ---allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty --- where --- f t = cldtPropagateFold h h g 0 t id --- h x _ _ _ = x + 1 --- g :: --- Int -> --- LocationLDT ItemLink OItem -> --- ( IM.IntMap (Int, LocationLDT ItemLink OItem) -> --- IM.IntMap (Int, LocationLDT ItemLink OItem) --- ) -> --- IM.IntMap (Int, LocationLDT ItemLink OItem) -> --- IM.IntMap (Int, LocationLDT ItemLink OItem) --- g x ldt = --- (.) --- ( IM.insert --- (ldt ^?! locLDT . ldtValue . _1 . itLocation . ilInvID) --- (x, ldt) --- ) - ----- returns an intmap with indents and locations for all items ---allInvLocs' :: IM.IntMap Item -> IM.IntMap (Int, LocationLDT ItemLink CItem) ---allInvLocs' inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees' inv)) mempty --- where --- f t = cldtPropagateFold h h g 0 t id --- h x _ _ _ = x + 1 --- g :: --- Int -> --- LocationLDT ItemLink CItem -> --- ( IM.IntMap (Int, LocationLDT ItemLink CItem) -> --- IM.IntMap (Int, LocationLDT ItemLink CItem) --- ) -> --- IM.IntMap (Int, LocationLDT ItemLink CItem) -> --- IM.IntMap (Int, LocationLDT ItemLink CItem) --- g x ldt = --- (.) --- ( IM.insert --- (ldt ^?! locLDT . ldtValue . _1 . itLocation . ilInvID) --- (x, ldt) --- )