Fix at least one bug from item refactor, more remain
This commit is contained in:
@@ -111,11 +111,11 @@ tryPutItemInInvAt i cid itid w = do
|
||||
-- return (Just i, w')
|
||||
|
||||
createItemYou :: Item -> World -> World
|
||||
createItemYou itm w = fromMaybe w' $ fmap snd $ tryPutItemInInv 0 itid w'
|
||||
createItemYou itm w = w' -- fromMaybe w' $ fmap snd $ tryPutItemInInv 0 itid w'
|
||||
where
|
||||
itid = IM.newKey $ w ^. cWorld . lWorld . items
|
||||
pos = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
|
||||
w' = copyItemToFloorID pos (itm & itID .~ NInt itid) w
|
||||
w' = copyItemToFloor pos (itm & itID .~ NInt itid) w
|
||||
|
||||
-- | Pick up a specific item.
|
||||
pickUpItem :: Int -> Int -> World -> World
|
||||
|
||||
@@ -46,7 +46,8 @@ crUpdateItemLocations :: Int -> LWorld -> LWorld
|
||||
crUpdateItemLocations crid lw = fromMaybe lw $ do
|
||||
mo <- lw ^? creatures . ix crid . crManipulation . manObject
|
||||
itids <- lw ^? creatures . ix crid . crInv
|
||||
let crinv = IM.restrictKeys (lw ^. items) (IS.fromList $ IM.elems itids)
|
||||
--let crinv = IM.restrictKeys (lw ^. items) (IS.fromList $ IM.elems itids)
|
||||
let crinv = fmap (\k -> lw ^?! items . ix k) itids
|
||||
return $ crSetRoots crid $ IM.foldlWithKey' (crUpdateInvidLocations mo crid) lw crinv
|
||||
|
||||
crSetRoots :: Int -> LWorld -> LWorld
|
||||
|
||||
Reference in New Issue
Block a user