diff --git a/ghcidOutput b/ghcidOutput index 20050b702..897dce813 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 17:16:08) +All good (594 modules, at 18:13:44) diff --git a/src/Dodge/Inventory/Swap.hs b/src/Dodge/Inventory/Swap.hs index c06d1d25e..828a9d1ba 100644 --- a/src/Dodge/Inventory/Swap.hs +++ b/src/Dodge/Inventory/Swap.hs @@ -17,7 +17,6 @@ import qualified IntMapHelp as IM import Dodge.Data.World import Control.Monad --- can be specialised for when we know that item i is selected swapInvItems :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> Int -> diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 91a49112c..8bdf7e3c9 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -139,16 +139,22 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of OverInvDrag k mpos _ _ -> input . mouseContext .~ MouseInGame $ fromMaybe w $ tryDropSelected mpos w <|> tryPickupSelected k mpos w + OverInvDragSelect ssel mesel | ScancodeLShift `M.member` (w ^. input . pressedKeys) + -> w & input . mouseContext .~ MouseInGame + & hud . hudElement . diSelection . _Just . _3 %~ getuniques + (maybe mempty (h ssel) (mesel ^? _Just . _2)) + -- note this assumes that mesel isn't outside the first + -- selection, this should perhaps just be made impossible by + -- removing the first part of the tuple OverInvDragSelect _ Nothing -> w & input . mouseContext .~ MouseInGame & hud . hudElement . diSelection . _Just . _3 %~ const mempty OverInvDragSelect ssel (Just esel) -> w & input . mouseContext .~ MouseInGame --- & hud . hudElement . diSelectionExtra --- .~ h ssel (snd esel) -- IM.keysSet [min (snd ssel) (snd esel) + 1 .. max (snd ssel) (snd esel)] & augInvDirectSelect (f (min ssel esel) (h ssel (snd esel))) _ -> w where + getuniques x y = IS.union x y IS.\\ IS.intersection x y f (x,y) z = (x,y,z) h (k,i) j = fold $ do sss <- w ^? hud . hudElement . diSections . ix k . ssItems @@ -164,6 +170,8 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of return $ w & input . mouseContext .~ OverInvDragSelect ysel Nothing + OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys ) + -> w & input . mouseContext .~ OverInvDragSelect x (Just x) OverInvSelect x -> startDrag x cfig w OverTerminalReturn tmid -> terminalReturnEffect tmid w OverTerminalEscape ->