Commit before messing with main inventory display

This commit is contained in:
2023-01-24 11:54:59 +00:00
parent 5810c2262a
commit ce25157738
13 changed files with 74 additions and 55 deletions
+5 -14
View File
@@ -35,20 +35,11 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
maybeInvSlot = checkInvSlotsYou it w
updateItLocation invid w' = w' & cWorld . lWorld . itemLocations . ix (_itID it) .~ InInv cid invid
--{- | Pick up a specific item. -}
--putItemInInv :: Int -> FloorItem -> World -> World
--putItemInInv cid flit w = case maybeInvSlot of
-- Nothing -> w
-- Just i -> w
-- & updateItLocation i
-- & floorItems %~ IM.delete (_flItID flit)
-- & creatures . ix cid . crInv %~ IM.insertWith (const $ itAmount +~ 1) i it
-- where
-- it = _flIt flit
-- maybeInvSlot = checkInvSlotsYou it w
-- updateItLocation invid w' = case _itID it of
-- Nothing -> w'
-- Just j -> w' & itemPositions . ix j .~ InInv cid invid
createAndSelectItem :: Item -> World -> World
createAndSelectItem itm w = case createPutItem itm w of
(Just i, w') -> w' & cWorld . lWorld . creatures . ix 0 . crInvSel .~ InvSel i NoInvSelAction
(Nothing, w') -> w'
createPutItem :: Item -> World -> (Maybe Int, World)
createPutItem it w =
uncurry (putItemInInvID 0) $