Add newtype for item id int

This commit is contained in:
2024-09-28 23:34:32 +01:00
parent 241191ee1b
commit 7d72fa3c5d
14 changed files with 274 additions and 267 deletions
+3 -3
View File
@@ -40,7 +40,7 @@ initCrItemLocations w cr = (w', cr & crInv .~ newinv)
-- does not worry about creature manipulation for now
initCrItemLocation :: Creature -> Int -> LWorld -> Item -> (LWorld,Item)
initCrItemLocation cr invid w it = (w & itemLocations . at locid ?~ loc
,it & itID .~ locid
,it & itID .~ NInt locid
& itLocation .~ loc)
where
locid = IM.newKey ( w ^. itemLocations)
@@ -55,7 +55,7 @@ initCrItemLocation cr invid w it = (w & itemLocations . at locid ?~ loc
initFlItemLocation :: LWorld -> FloorItem -> (LWorld, FloorItem)
initFlItemLocation w flit = (w & itemLocations . at locid ?~ loc
, flit & flIt . itID .~ locid
, flit & flIt . itID .~ NInt locid
& flIt . itLocation .~ loc
)
where
@@ -69,6 +69,6 @@ initTuItemLocation w mc = case mc ^? mcType . _McTurret . tuWeapon of
let locid = IM.newKey ( w ^. itemLocations)
loc = OnTurret (_mcID mc)
in ( w & itemLocations . at locid ?~ loc
, mc & mcType . _McTurret . tuWeapon . itID .~ locid
, mc & mcType . _McTurret . tuWeapon . itID .~ NInt locid
& mcType . _McTurret . tuWeapon . itLocation .~ loc
)