Cleanup warnings
This commit is contained in:
+5
-16
@@ -6,9 +6,8 @@ import Geometry
|
||||
|
||||
import Data.Maybe
|
||||
import Data.List
|
||||
import Data.Function (on)
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import System.Random
|
||||
--import System.Random
|
||||
import Control.Lens
|
||||
|
||||
checkInvSlotsYou' :: Maybe Item -> World -> Maybe Int
|
||||
@@ -39,7 +38,7 @@ checkInvSlots it its = fmap fst $ find cond $ IM.toList its
|
||||
|
||||
addItem :: Item -> Item -> Item
|
||||
addItem it NoItem = it
|
||||
addItem it it' = it' & itAmount +~ 1
|
||||
addItem _ it' = it' & itAmount +~ 1
|
||||
|
||||
numInventorySlots :: Int
|
||||
numInventorySlots = 9
|
||||
@@ -52,19 +51,9 @@ rmInvItem
|
||||
-> Int -- ^ Inventory position
|
||||
-> World
|
||||
-> World
|
||||
rmInvItem n i w =
|
||||
let item = _crInv (_creatures w IM.! n) IM.! i
|
||||
itRef = creatures . ix n . crInv . ix i
|
||||
in case item of
|
||||
Consumable {_itAmount = 1} -> set itRef NoItem w
|
||||
Craftable {_itAmount = 1} -> set itRef NoItem w
|
||||
Equipment {_itAmount = 1} -> set itRef NoItem w
|
||||
Throwable {_itAmount = 1} -> set itRef NoItem w
|
||||
Consumable {_itAmount = x} -> over (itRef . itAmount) (\y-> y-1) w
|
||||
Craftable {_itAmount = x} -> over (itRef . itAmount) (\y-> y-1) w
|
||||
Equipment {_itAmount = x} -> over (itRef . itAmount) (\y-> y-1) w
|
||||
Throwable {_itAmount = x} -> over (itRef . itAmount) (\y-> y-1) w
|
||||
_ -> set itRef NoItem w
|
||||
rmInvItem cid itid w = case w ^? creatures . ix cid . crInv . ix itid . itAmount of
|
||||
Just x | x > 1 -> w & creatures . ix cid . crInv . ix itid . itAmount %~ subtract 1
|
||||
_ -> w & creatures . ix cid . crInv . ix itid .~ NoItem
|
||||
{- Delete a creature's selected item, the item will no longer exist. -}
|
||||
rmSelectedInvItem
|
||||
:: Int -- ^ Creature id
|
||||
|
||||
Reference in New Issue
Block a user