Tweak cursor storage on sss
This commit is contained in:
+10
-13
@@ -2,9 +2,6 @@
|
||||
|
||||
module Dodge.Inventory (
|
||||
selSecSelPos,
|
||||
ssLookupDown,
|
||||
ssLookupGT,
|
||||
ssSetCursor,
|
||||
firstPosSelectionSections,
|
||||
checkInvSlotsYou,
|
||||
rmSelectedInvItem,
|
||||
@@ -18,7 +15,7 @@ module Dodge.Inventory (
|
||||
updateTerminal,
|
||||
closeObjScrollDir,
|
||||
changeSwapInvSel,
|
||||
changeAugInvSel,
|
||||
scrollAugInvSel,
|
||||
crNumFreeSlots,
|
||||
crInvSize,
|
||||
selectedCloseObject,
|
||||
@@ -67,15 +64,15 @@ rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount
|
||||
& doanyitemeffect
|
||||
& pointcid . crInvEquipped %~ IM.delete invid
|
||||
& pointcid . crInvEquipped %~ IM.mapKeys g
|
||||
& updatemanipulation
|
||||
& updateselection
|
||||
where
|
||||
|
||||
getcid = cWorld . lWorld . creatures . ix cid
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
updatemanipulation
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . inInventory . ispItem == Just invid
|
||||
= (pointcid . crManipulation . manObject . inInventory . ispItem %~ g) . changeAugInvSel (-1)
|
||||
= scrollAugInvSel (-1) . scrollAugInvSel 1
|
||||
| otherwise
|
||||
= pointcid . crManipulation . manObject . inInventory . ispItem %~ g
|
||||
|
||||
@@ -181,9 +178,9 @@ updateCloseObjects w =
|
||||
updatecursorposifnecessary
|
||||
= case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject. inNearby . ispCloseObject of
|
||||
Just i
|
||||
| i >= length newcloseobjects -> changeAugInvSel 1
|
||||
| i >= length newcloseobjects -> scrollAugInvSel 1
|
||||
| isNothing (w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems . ix i)
|
||||
-> changeAugInvSel (-1)
|
||||
-> scrollAugInvSel (-1)
|
||||
_ -> id
|
||||
filt = filter $ \obj -> dist ypos (closeObjPos obj) < 40 && hasButtonLOS ypos (closeObjPos obj) w
|
||||
ypos = _crPos $ you w
|
||||
@@ -360,8 +357,8 @@ changeSwapInvSel k w = case you w ^? crManipulation . manObject of
|
||||
n = length $ _crInv cr
|
||||
numCO = length $ w ^. hud . closeObjects
|
||||
|
||||
changeAugInvSel :: Int -> World -> World
|
||||
changeAugInvSel yi w
|
||||
scrollAugInvSel :: Int -> World -> World
|
||||
scrollAugInvSel yi w
|
||||
| yi == 0 = w
|
||||
| otherwise =
|
||||
w & hud . hudElement . diSections %~ scrollSelectionSections yi
|
||||
@@ -373,8 +370,8 @@ setInvPosFromSS w = w
|
||||
where
|
||||
thesel = fromMaybe SelNothing $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
i <- sss ^? sssSelPos . _Just
|
||||
j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
|
||||
(i,j) <- sss ^? sssSelPos . _Just
|
||||
-- j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
|
||||
case i of
|
||||
(-1) -> Just $ InInventory SortInventory
|
||||
0 -> Just $ InInventory (SelItem j NoInvSelAction)
|
||||
|
||||
Reference in New Issue
Block a user