From 3dc70c483a3acc68cfef7f5ac0e8a9a4a0622f75 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 12 Jul 2025 14:08:17 +0100 Subject: [PATCH] Continue LDT -> DT --- src/Dodge/Item/Grammar.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index b9614a90f..c640c170a 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -1,7 +1,7 @@ {-# LANGUAGE TupleSections #-} module Dodge.Item.Grammar ( invDT, - invLDT, +-- invLDT, invDT', invAdj, invRootMap, @@ -246,10 +246,10 @@ 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) +--invLDT :: IM.IntMap Item -> [LDTree ItemLink CItem] +--invLDT = +-- joinItemsInList tryAttachItems . IM.elems +-- . fmap (singleLDT . baseCI) invDT :: IM.IntMap Item -> [DTree CItem] invDT = fmap ldtToDT . @@ -269,8 +269,8 @@ invDT' = fmap propagateOrientation' . invDT invRootMap :: IM.IntMap Item -> IM.IntMap (Maybe Int, DTree Item) invRootMap = foldMap - (dtToIntMapWithRoot (^?! itLocation . ilInvID) . fmap (^. _1) . ldtToDT) - . invLDT + (dtToIntMapWithRoot (^?! itLocation . ilInvID) . fmap (^. _1) ) + . invDT -- this assumes the creature inventory is well formed, specifically the -- location ids @@ -278,9 +278,9 @@ invRootMap = -- should be done upstream anyway in the actually creature inventory) -- The first Int in the maybe is the root, the second the parent invAdj :: IM.IntMap Item -> IM.IntMap (Maybe (Int, Int), [Int], [Int]) -invAdj = IM.unions . map g . invLDT +invAdj = IM.unions . map g . invDT where - g = dtToLRAdj getid . ldtToDT + g = dtToLRAdj getid getid (itm, _) = fromMaybe (error ("invAdj item " ++ show (_itID itm) ++ " location: " ++ show (itm ^? itLocation)))