Cleanup
This commit is contained in:
@@ -199,19 +199,11 @@ joinItemsInList f = fst . h . ([],)
|
|||||||
Just w -> h ( zs,w : ys)
|
Just w -> h ( zs,w : ys)
|
||||||
|
|
||||||
-- this puts the first elements in the intmap at the end of the list
|
-- 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 :: IM.IntMap Item -> [DTree CItem]
|
||||||
invDT =
|
invDT =
|
||||||
joinItemsInList tryAttachItems . IM.elems
|
joinItemsInList tryAttachItems . IM.elems
|
||||||
. fmap (singleDT . baseCI)
|
. fmap (singleDT . baseCI)
|
||||||
|
|
||||||
--invLDT' :: IM.IntMap Item -> [LDTree ItemLink OItem]
|
|
||||||
--invLDT' = fmap propagateOrientation . invLDT
|
|
||||||
|
|
||||||
invDT' :: IM.IntMap Item -> [DTree OItem]
|
invDT' :: IM.IntMap Item -> [DTree OItem]
|
||||||
invDT' = fmap propagateOrientation' . invDT
|
invDT' = fmap propagateOrientation' . invDT
|
||||||
|
|
||||||
@@ -240,24 +232,13 @@ invAdj = IM.unions . map g . invDT
|
|||||||
$ itm ^? itLocation . ilInvID
|
$ itm ^? itLocation . ilInvID
|
||||||
|
|
||||||
---- returns an intmap with trees for (only!) root items, indexed by inventory position
|
---- 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 :: IM.IntMap Item -> IM.IntMap (DTree OItem)
|
||||||
invIMDT = fmap propagateOrientation' . IM.fromDistinctAscList . reverse . map getid . invDT
|
invIMDT = fmap propagateOrientation' . IM.fromDistinctAscList . reverse . map getid . invDT
|
||||||
where
|
where
|
||||||
getid :: DTree CItem -> (Int, DTree CItem)
|
getid :: DTree CItem -> (Int, DTree CItem)
|
||||||
getid t = (t ^?! dtValue . _1 . itLocation . ilInvID, t)
|
getid t = (t ^?! dtValue . _1 . itLocation . ilInvID, t)
|
||||||
|
|
||||||
--invRootTrees' :: IM.IntMap Item -> IM.IntMap (LDTree ItemLink CItem)
|
---- returns an intmap with indents and locations for all items
|
||||||
--invRootTrees' = IM.fromDistinctAscList . reverse . map getid . invLDT
|
|
||||||
-- where
|
|
||||||
-- getid :: LDTree ItemLink CItem -> (Int, LDTree ItemLink CItem)
|
|
||||||
-- getid t = (t ^?! ldtValue . _1 . itLocation . ilInvID, t)
|
|
||||||
|
|
||||||
invIndents :: IM.IntMap Item -> IM.IntMap (Int, LocationDT OItem)
|
invIndents :: IM.IntMap Item -> IM.IntMap (Int, LocationDT OItem)
|
||||||
invIndents inv = foldMap (f . LocDT TopDT) (IM.elems (invIMDT inv)) mempty
|
invIndents inv = foldMap (f . LocDT TopDT) (IM.elems (invIMDT inv)) mempty
|
||||||
where
|
where
|
||||||
@@ -277,46 +258,3 @@ invIndents inv = foldMap (f . LocDT TopDT) (IM.elems (invIMDT inv)) mempty
|
|||||||
(ldt ^?! locDT . dtValue . _1 . itLocation . ilInvID)
|
(ldt ^?! locDT . dtValue . _1 . itLocation . ilInvID)
|
||||||
(x, ldt)
|
(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)
|
|
||||||
-- )
|
|
||||||
|
|||||||
Reference in New Issue
Block a user