Cleanup
This commit is contained in:
@@ -4,9 +4,10 @@ module Dodge.Inventory.CheckSlots (
|
||||
crInvSize,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Monoid
|
||||
import Dodge.Base.You
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.SlotsTaken
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
{- | checks whether or not an item will fit in your inventory
|
||||
@@ -14,7 +15,7 @@ import qualified IntMapHelp as IM
|
||||
-}
|
||||
checkInvSlotsYou :: Item -> World -> Maybe Int
|
||||
checkInvSlotsYou it w
|
||||
| crNumFreeSlots ycr >= ceiling (_itInvSize it) =
|
||||
| crNumFreeSlots ycr >= _itInvSize it =
|
||||
Just $ findItemSlot (_crInv ycr)
|
||||
| otherwise = Nothing
|
||||
where
|
||||
@@ -38,4 +39,5 @@ crInvSize :: Creature -> Int
|
||||
crInvSize = invSize . _crInv
|
||||
|
||||
invSize :: IM.IntMap Item -> Int
|
||||
invSize = sum . fmap itSlotsTaken
|
||||
invSize = alaf Sum foldMap _itInvSize
|
||||
--invSize = sum . fmap _itInvSize
|
||||
|
||||
@@ -8,7 +8,6 @@ import Padding
|
||||
import Dodge.Equipment.Text
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.SlotsTaken
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Item.InventoryColor
|
||||
import LensHelp
|
||||
@@ -18,7 +17,7 @@ invSelectionItem' :: Creature -> Int -> Item -> SelectionItem ()
|
||||
invSelectionItem' cr i it =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = itSlotsTaken it
|
||||
, _siHeight = _itInvSize it
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = 0
|
||||
@@ -36,7 +35,7 @@ invSelectionItem :: Creature -> Int -> (Item,Int,a) -> SelectionItem ()
|
||||
invSelectionItem cr i (it,indent,_) =
|
||||
SelectionItem
|
||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||
, _siHeight = itSlotsTaken it
|
||||
, _siHeight = _itInvSize it
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = indent
|
||||
|
||||
Reference in New Issue
Block a user