Use NewIntMap InvInt for crInv

This commit is contained in:
2025-08-25 10:21:59 +01:00
parent 25e64d5378
commit 3f6f1b4019
38 changed files with 437 additions and 406 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
module Dodge.Inventory.Path (getInventoryPath) where
import NewInt
import Dodge.Data.Creature
import qualified Data.IntMap.Strict as IM
import Control.Lens
@@ -9,10 +10,10 @@ getInventoryPath :: Int -> InventoryPathing -> Int -> Creature -> Maybe Int
getInventoryPath x ip itid cr = case ip of
ABSOLUTE -> checkinvid x
RELCURS -> do
selid <- cr ^? crManipulation . manObject . imSelectedItem
selid <- cr ^? crManipulation . manObject . imSelectedItem . unNInt
checkinvid (x + selid)
RELITEM -> checkinvid (itid + x)
where
checkinvid y = do
guard $ y `IM.member` (cr ^. crInv)
guard $ y `IM.member` (cr ^. crInv . unNIntMap)
return y