Move item inv size and item dimensions from records to external function
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Update.Input.InGame (
|
||||
updateMouseInGame,
|
||||
) where
|
||||
|
||||
import Dodge.Item.InvSize
|
||||
import Data.Monoid
|
||||
import NewInt
|
||||
import Control.Applicative
|
||||
@@ -125,7 +126,7 @@ tryPickupSelected k mpos w = do
|
||||
let nfreeslots = crNumFreeSlots cr
|
||||
xs <- w ^? hud . hudElement . diSelection . _Just . _3
|
||||
let itmstopickup = mapMaybe g $ IS.toList xs
|
||||
let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) itmstopickup
|
||||
let slotsneeded = alaf Sum foldMap (itInvHeight . _flIt) itmstopickup
|
||||
guard $ nfreeslots >= slotsneeded
|
||||
return $ case mpos of
|
||||
Just (0,j) -> foldr (pickUpItemAt j 0) w itmstopickup
|
||||
@@ -507,7 +508,7 @@ spaceAction w = case w ^. hud . hudElement of
|
||||
DisplayCarte -> w & hud . carteCenter .~ theLoc
|
||||
DisplayInventory{_subInventory = NoSubInventory{}} -> fromMaybe w $ do
|
||||
cobj <- selCloseObj w
|
||||
return $ case cobj of -- case Left <$> selectedCloseItem w of
|
||||
return $ case cobj of
|
||||
(Left flit) -> pickUpItem 0 flit w
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
(Right but) -> doButtonEvent (_btEvent but) but w
|
||||
|
||||
Reference in New Issue
Block a user