Remove Either construct over invAdj
This commit is contained in:
@@ -179,16 +179,13 @@ invRootMap = foldMap (dtToIntMapWithRoot (^?! itLocation . ilInvID) . fmap (^. _
|
||||
-- location ids
|
||||
-- consider explicitly reseting the inventory ids (but this probably really
|
||||
-- should be done upstream anyway in the actually creature inventory)
|
||||
invAdj :: IM.IntMap Item -> Either String (IM.IntMap (Maybe (Int, Int), [Int], [Int]))
|
||||
invAdj im = do
|
||||
l <- mapM g $ invLDT im
|
||||
return $ IM.unions l
|
||||
invAdj :: IM.IntMap Item -> IM.IntMap (Maybe (Int, Int), [Int], [Int])
|
||||
invAdj im = IM.unions . map g $ invLDT im
|
||||
where
|
||||
g = dtToLRAdjEither getid . ldtToDT
|
||||
g = dtToLRAdj getid . ldtToDT
|
||||
getid (itm, _, _) =
|
||||
maybe
|
||||
(Left ("invAdj item " ++ show (_itID itm) ++ " location: " ++ show (itm ^? itLocation)))
|
||||
Right
|
||||
fromMaybe
|
||||
(error ("invAdj item " ++ show (_itID itm) ++ " location: " ++ show (itm ^? itLocation)))
|
||||
$ itm ^? itLocation . ilInvID
|
||||
|
||||
-- returns an intmap with trees for all items
|
||||
|
||||
Reference in New Issue
Block a user