Improve item combination algorithm
This commit is contained in:
@@ -11,7 +11,7 @@ putItemInInvID cid flid w = fromMaybe w
|
||||
$ tryPutItemInInv cid (_floorItems w IM.! flid) w
|
||||
|
||||
putItemInInvSlot :: Int -> Item -> IM.IntMap Item -> IM.IntMap Item
|
||||
putItemInInvSlot = IM.insertWith (const $ itConsumption . itAmount +~ 1)
|
||||
putItemInInvSlot = IM.insertWith (const $ itConsumption . icAmount +~ 1)
|
||||
|
||||
{- | Pick up a specific item. -}
|
||||
tryPutItemInInv :: Int -> FloorItem -> World -> Maybe World
|
||||
|
||||
@@ -8,6 +8,6 @@ import Control.Lens
|
||||
--import Data.Maybe
|
||||
|
||||
itSlotsTaken :: Item -> Int
|
||||
itSlotsTaken it = case it ^? itConsumption . itAmount of
|
||||
itSlotsTaken it = case it ^? itConsumption . icAmount of
|
||||
Nothing -> moduleSizes it + ceiling (_itInvSize it)
|
||||
Just i -> moduleSizes it + ceiling (_itInvSize it * fromIntegral i)
|
||||
|
||||
Reference in New Issue
Block a user