Move towards displaying tree links in inventory

This commit is contained in:
2024-09-13 12:02:28 +01:00
parent c81fd5490d
commit bd681a577c
8 changed files with 85 additions and 45 deletions
+5 -2
View File
@@ -84,8 +84,11 @@ invLDT :: IM.IntMap Item -> [LabelDoubleTree ComposeLinkType ComposedItemStructu
invLDT = joinItemsInList (leftRightCombine leftIsParentCombine rightIsParentCombine) . IM.elems .
fmap (singleLDT . baseCIS)
invIndentIM' :: IM.IntMap Item -> IM.IntMap (Item,Int, ())
invIndentIM' = fmap (\x -> (x,0,()))
invAdj :: IM.IntMap Item -> IM.IntMap ([Int],[Int])
invAdj = IM.unions . fmap (dtToUpDownAdj getid . ldtToDT) . invLDT
where
getid (itm, _,_,_) = fromMaybe (error "invAdj attempt to find item not in inventory") $
itm ^? itLocation . ipInvID
invIndentIM :: IM.IntMap Item -> IM.IntMap (Item,Int, LabelDoubleTreeNodeType ComposeLinkType )
invIndentIM = IM.fromAscList . zip [0..] . reverse . map (over _1 cisToItem) . concatMap ldtToIndentList . invLDT