diff --git a/src/Dodge/Data/RightButtonOptions.hs b/src/Dodge/Data/RightButtonOptions.hs index c98242079..3be828dfb 100644 --- a/src/Dodge/Data/RightButtonOptions.hs +++ b/src/Dodge/Data/RightButtonOptions.hs @@ -12,10 +12,7 @@ import Dodge.Data.Equipment.Misc data RightButtonOptions = NoRightButtonOptions - | EquipOptions - { _opEquip :: [EquipPosition] - , _opSel :: Int - } + | EquipOptions { _opSel :: Int } --deriving (Eq, Ord, Show, Read) --Generic, Flat) data EquipmentAllocation diff --git a/src/Dodge/Inventory/RBList.hs b/src/Dodge/Inventory/RBList.hs index ae82b5339..cb5bad290 100644 --- a/src/Dodge/Inventory/RBList.hs +++ b/src/Dodge/Inventory/RBList.hs @@ -25,8 +25,7 @@ updateRBList w w & rbOptions .~ EquipOptions - { _opEquip = equipSiteToPositions esite - , _opSel = chooseEquipmentPosition cr (equipSiteToPositions esite) + { _opSel = chooseEquipmentPosition cr (equipSiteToPositions esite) } where cr = you w diff --git a/src/Dodge/Update/Scroll.hs b/src/Dodge/Update/Scroll.hs index d75606b7c..e9821d72c 100644 --- a/src/Dodge/Update/Scroll.hs +++ b/src/Dodge/Update/Scroll.hs @@ -27,7 +27,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of -- this lock can be sensibly applied, perhaps | w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w | rbDown -> case (yourItem w ^? _Just . itUse . heldScroll, _rbOptions w) of - (_, EquipOptions{}) -> w & rbOptions %~ scrollRBOption yi + (_, EquipOptions{}) -> w & rbOptions . opSel %~ scrollRBOption yi rbscrollmax (Nothing, _) -> closeObjScrollDir y w (Just f, _) -> doHeldScroll f y (you w) w | lbDown -> w & wCam . camZoom +~ y @@ -42,6 +42,10 @@ updateWheelEvent yi w = case w ^. hud . hudElement of DisplayInventory{_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w _ -> w where + rbscrollmax = fromMaybe 1 $ do + invid <- you w ^? crManipulation . manObject . inInventory . ispItem + esite <- you w ^? crInv . ix invid . itUse . equipEffect . eeSite + return $ length $ equipSiteToPositions esite y = fromIntegral yi numLocs = (fst . IM.findMax $ (w ^. cWorld . lWorld . seenLocations)) + 1 rbDown = ButtonRight `M.member` _mouseButtons (_input w) @@ -97,11 +101,11 @@ terminalWheelEvent yi tmid w tc = scrollCommands tm !! i arg = getArguments' tc tm w !! j -scrollRBOption :: Int -> RightButtonOptions -> RightButtonOptions -scrollRBOption y w - | y < 0 = w & opSel %~ (min (length (_opEquip w) -1) . subtract y) - | y > 0 = w & opSel %~ (max 0 . subtract y) - | otherwise = w +scrollRBOption :: Int -> Int -> Int -> Int +scrollRBOption dy ymax + | dy < 0 = (min (ymax -1) . subtract dy) + | dy > 0 = (max 0 . subtract dy) + | otherwise = id moveTweakSel :: Int -> World -> World moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of