Refactor triplet to Selection datatype

This commit is contained in:
2025-08-26 18:13:27 +01:00
parent 9034c409e1
commit b87c3380b8
16 changed files with 127 additions and 135 deletions
+5 -5
View File
@@ -60,7 +60,7 @@ drawInventory sss w cfig =
<> itemconnections
<> drawMouseOver cfig w
where
f = fmap (\(x, y, _) -> (x, y))
f = fmap (\(Sel x y _) -> (x, y))
curs = invCursorParams w
itemconnections = fromMaybe mempty $ do
inv' <- w ^? cWorld . lWorld . creatures . ix 0 . crInv
@@ -131,14 +131,14 @@ drawMouseOver cfig w =
drawDragSelected :: Configuration -> World -> Maybe Picture
drawDragSelected cfig w = do
ys <- w ^? hud . diSelection . _Just . _3
ys <- w ^? hud . diSelection . _Just . slSet
guard $
not (IS.null ys)
&& ( case w ^? hud . subInventory of
Just NoSubInventory -> True
_ -> False
)
(i, _, _) <- w ^? hud . diSelection . _Just
Sel i _ _ <- w ^? hud . diSelection . _Just
sss <- w ^? hud . diSections
let f x = (selSecDrawCursorAt invDP BackdropCursor sss (i, x) <>)
return . translateScreenPos cfig (invDP ^. ldpPos)
@@ -188,7 +188,7 @@ drawCombineInventory cfig sss w =
where
curs = BoundaryCursor [North, South, West]
msel =
fmap (\(x, y, _) -> (x, y)) $
fmap (\(Sel x y _) -> (x, y)) $
w ^? hud . subInventory . ciSelection . _Just
drawExamineInventory :: Configuration -> World -> Picture
@@ -254,7 +254,7 @@ drawRBOptions cfig w = fold $ do
i <- w ^? rbOptions . opSel
let ae = getEquipmentAllocation invid w
sss <- w ^? hud . diSections
(i', j, _) <- w ^? hud . diSelection . _Just
Sel i' j _ <- w ^? hud . diSelection . _Just
curpos <- selSecYint i' j sss
let ytext = drawListElement 0 1 0 curpos . text
midstr = equipAllocString ae
+1 -1
View File
@@ -115,7 +115,7 @@ mouseCursorType u = case u ^. uvWorld . input . mouseContext of
MouseGameRotate -> rotate a (drawVerticalDoubleArrow 5)
where
w = u ^. uvWorld
selsec = u ^? uvWorld . hud . diSelection . _Just . _1
selsec = u ^? uvWorld . hud . diSelection . _Just . slSec
a = fromMaybe 0 $ do
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
return . toClosestMultiple (pi / 32) $