Add newtype to floor item ids
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.Inventory.Add (
|
||||
pickUpItem,
|
||||
) where
|
||||
|
||||
import NewInt
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Inventory.Location
|
||||
--import Dodge.Item.Grammar
|
||||
@@ -18,9 +19,9 @@ import Dodge.FloorItem
|
||||
import Dodge.Inventory.CheckSlots
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
tryPutItemIDInInv :: Int -> Int -> World -> Maybe (Int, World)
|
||||
tryPutItemIDInInv :: Int -> NewInt FloorInt -> World -> Maybe (Int, World)
|
||||
tryPutItemIDInInv cid flitid w = do
|
||||
flit <- w ^? cWorld . lWorld . floorItems . ix flitid
|
||||
flit <- w ^? cWorld . lWorld . floorItems . unNIntMap . ix (_unNInt flitid)
|
||||
tryPutItemInInv cid flit w
|
||||
|
||||
-- | Pick up a specific item.
|
||||
@@ -32,7 +33,7 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
( i
|
||||
, w
|
||||
& updateItLocation i
|
||||
& cWorld . lWorld . floorItems %~ IM.delete (_flItID flit)
|
||||
& cWorld . lWorld . floorItems . unNIntMap %~ IM.delete (_unNInt $ _flItID flit)
|
||||
-- & cWorld . lWorld . creatures . ix cid . crInv %~ IM.insert i it
|
||||
& cWorld . lWorld . creatures . ix cid . crInv . at i ?~ it
|
||||
& setInvPosFromSS
|
||||
|
||||
Reference in New Issue
Block a user