Use NewIntMap InvInt for crInv
This commit is contained in:
@@ -20,7 +20,7 @@ import NewInt
|
||||
|
||||
-- should check that the item is not already in your inventory
|
||||
-- this assumes that this is a floor item
|
||||
tryPutItemInInv :: Int -> Int -> World -> Maybe (Int,World)
|
||||
tryPutItemInInv :: Int -> Int -> World -> Maybe (NewInt InvInt,World)
|
||||
tryPutItemInInv cid itid w = do
|
||||
itm <- w ^? cWorld . lWorld . items . ix itid
|
||||
invid <- checkInvSlotsYou itm w
|
||||
@@ -51,8 +51,8 @@ tryPutItemInInv cid itid w = do
|
||||
tryPutItemInInvAt :: Int -> Int -> Int -> World -> Maybe World
|
||||
tryPutItemInInvAt i cid itid w = do
|
||||
(j, w') <- tryPutItemInInv cid itid w
|
||||
guard (i <= j)
|
||||
return $ foldr f w' [i + 1 .. j]
|
||||
guard (i <= _unNInt j)
|
||||
return $ foldr f w' [i + 1 .. _unNInt j]
|
||||
where
|
||||
f j = swapInvItems (\_ _ -> Just (j -1)) j
|
||||
|
||||
|
||||
Reference in New Issue
Block a user