Add newtype to floor item ids

This commit is contained in:
2024-09-23 22:42:09 +01:00
parent 43b365185d
commit 265da89791
20 changed files with 193 additions and 158 deletions
+4 -3
View File
@@ -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