Move item inv size and item dimensions from records to external function

This commit is contained in:
2024-11-26 23:36:08 +00:00
parent 9534698a24
commit b21513c4dd
22 changed files with 187 additions and 176 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ module Dodge.Inventory.CheckSlots (
crInvSize,
) where
import Dodge.Item.InvSize
import Control.Lens
import Data.Monoid
import Dodge.Base.You
@@ -15,7 +16,7 @@ import qualified IntMapHelp as IM
-}
checkInvSlotsYou :: Item -> World -> Maybe Int
checkInvSlotsYou it w
| crNumFreeSlots ycr >= _itInvSize it =
| crNumFreeSlots ycr >= itInvHeight it =
Just . IM.newKey $ _crInv ycr
| otherwise = Nothing
where
@@ -28,5 +29,5 @@ crInvSize :: Creature -> Int
crInvSize = invSize . _crInv
invSize :: IM.IntMap Item -> Int
invSize = alaf Sum foldMap _itInvSize
invSize = alaf Sum foldMap itInvHeight
--invSize = sum . fmap _itInvSize