Use fromDistinctAscList rather than fromAscList
This commit is contained in:
@@ -182,7 +182,7 @@ invAdj im = do
|
||||
|
||||
invIndentIM :: IM.IntMap Item -> IM.IntMap (Item, Int, LabelDoubleTreeNodeType ComposeLinkType)
|
||||
invIndentIM =
|
||||
IM.fromAscList . zip [0 ..] . reverse . map (over _1 (^. _1))
|
||||
IM.fromDistinctAscList . zip [0 ..] . reverse . map (over _1 (^. _1))
|
||||
. concatMap ldtToIndentList
|
||||
. map (bimap _iatType (\(x, y, _) -> (x, y)))
|
||||
. invLDT
|
||||
@@ -215,7 +215,7 @@ allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempt
|
||||
|
||||
-- returns an intmap with trees for root items, indexed by inventory position
|
||||
invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem)
|
||||
invRootTrees = IM.fromAscList . reverse . map (getid . fmap (\(x, y, _) -> CItem x y)) . invLDT
|
||||
invRootTrees = IM.fromDistinctAscList . reverse . map (getid . fmap (\(x, y, _) -> CItem x y)) . invLDT
|
||||
where
|
||||
getid :: LabelDoubleTree ItemLink ComposedItem -> (Int,LabelDoubleTree ItemLink ComposedItem)
|
||||
getid t = (t ^?! ldtValue . cItem . itLocation . ilInvID, t)
|
||||
|
||||
Reference in New Issue
Block a user