Move item inv size and item dimensions from records to external function
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -6,6 +6,7 @@ module Dodge.Inventory.SelectionList (
|
||||
closeButtonToSelectionItem,
|
||||
) where
|
||||
|
||||
import Dodge.Item.InvSize
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
@@ -22,7 +23,7 @@ invSelectionItem :: Int -> Creature -> Int -> ComposedItem -> SelectionItem ()
|
||||
invSelectionItem indent cr i ci =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = _itInvSize $ _cItem ci
|
||||
, _siHeight = itInvHeight $ _cItem ci
|
||||
, _siWidth = 15
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
|
||||
Reference in New Issue
Block a user