Add newtype for item id int
This commit is contained in:
@@ -48,7 +48,7 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
it = _flIt flit
|
||||
maybeInvSlot = checkInvSlotsYou it w
|
||||
-- not sure if the following is necessary
|
||||
updateItLocation invid w' = w' & cWorld . lWorld . itemLocations . ix (_itID it)
|
||||
updateItLocation invid w' = w' & cWorld . lWorld . itemLocations . ix (_unNInt $ _itID it)
|
||||
.~ InInv
|
||||
{_ilCrID = cid
|
||||
, _ilInvID = invid
|
||||
@@ -82,7 +82,7 @@ createItemYou itm w = fromMaybe (OnFloor flid, w') $ do
|
||||
where
|
||||
itid = IM.newKey $ w ^. cWorld . lWorld . itemLocations
|
||||
pos = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
|
||||
(flid,w') = copyItemToFloorID pos (itm & itID .~ itid) w
|
||||
(flid,w') = copyItemToFloorID pos (itm & itID .~ NInt itid) w
|
||||
|
||||
|
||||
-- | Pick up a specific item.
|
||||
|
||||
@@ -6,6 +6,7 @@ module Dodge.Inventory.Location
|
||||
)
|
||||
where
|
||||
|
||||
import NewInt
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Base.You
|
||||
import Dodge.Data.SelectionList
|
||||
@@ -55,7 +56,7 @@ crUpdateInvidLocations mo crid lw invid itm = lw
|
||||
& creatures . ix crid . crInv . ix invid . itLocation .~ newloc
|
||||
& itemLocations %~ IM.insert itid newloc
|
||||
where
|
||||
itid = itm ^. itID
|
||||
itid = itm ^. itID . unNInt
|
||||
newloc = InInv
|
||||
{ _ilCrID = crid
|
||||
, _ilInvID = invid
|
||||
|
||||
Reference in New Issue
Block a user