Continue tree based inventory update
This commit is contained in:
@@ -4,8 +4,6 @@ module Dodge.Inventory.CheckSlots (
|
||||
crInvSize,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.You
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.SlotsTaken
|
||||
@@ -17,15 +15,15 @@ import qualified IntMapHelp as IM
|
||||
checkInvSlotsYou :: Item -> World -> Maybe Int
|
||||
checkInvSlotsYou it w
|
||||
| crNumFreeSlots ycr >= ceiling (_itInvSize it) =
|
||||
Just $ findItemSlot it (_crInv ycr)
|
||||
Just $ findItemSlot (_crInv ycr)
|
||||
| otherwise = Nothing
|
||||
where
|
||||
ycr = you w
|
||||
|
||||
-- Assumes that the item is singular.
|
||||
-- Do not want to stack floor items for now
|
||||
findItemSlot :: Item -> IM.IntMap Item -> Int
|
||||
findItemSlot it inv = maybe 0 ((+ 1) . fst) $ IM.lookupMax inv
|
||||
findItemSlot :: IM.IntMap Item -> Int
|
||||
findItemSlot = maybe 0 ((+ 1) . fst) . IM.lookupMax
|
||||
--findItemSlot it inv = case it ^? itUse . useAmount of
|
||||
-- Just _ ->
|
||||
-- fromMaybe newslot $ IM.findIndex (\it' -> _itType it == _itType it') inv
|
||||
|
||||
Reference in New Issue
Block a user