Fix cursor selection when dropping filtered items
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
module Dodge.Inventory.Add where
|
||||
module Dodge.Inventory.Add
|
||||
( tryPutItemInInv
|
||||
, createPutItem
|
||||
, createAndSelectItem
|
||||
)where
|
||||
|
||||
import Dodge.Data.SelectionList
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Base.You
|
||||
@@ -38,6 +43,7 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
createAndSelectItem :: Item -> World -> World
|
||||
createAndSelectItem itm w = case createPutItem itm w of
|
||||
(Just i, w') -> w'
|
||||
& hud . hudElement . diSections . sssExtra . sssSelPos ?~ (0,i)
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
|
||||
.~ InInventory (SelItem i NoInvSelAction)
|
||||
(Nothing, w') -> w'
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
module Dodge.Inventory.CheckSlots where
|
||||
module Dodge.Inventory.CheckSlots (
|
||||
checkInvSlotsYou,
|
||||
crNumFreeSlots,
|
||||
crInvSize,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
@@ -13,11 +17,10 @@ import qualified IntMapHelp as IM
|
||||
checkInvSlotsYou :: Item -> World -> Maybe Int
|
||||
checkInvSlotsYou it w
|
||||
| crNumFreeSlots ycr >= ceiling (_itInvSize it) =
|
||||
Just $ findItemSlot it inv
|
||||
Just $ findItemSlot it (_crInv ycr)
|
||||
| otherwise = Nothing
|
||||
where
|
||||
ycr = you w
|
||||
inv = _crInv ycr
|
||||
|
||||
-- Assumes that the item is singular.
|
||||
-- Do not want to stack floor items for now
|
||||
|
||||
Reference in New Issue
Block a user