Fix bug pickup up items scrolling down by inventory position

This commit is contained in:
2026-05-18 09:25:55 +01:00
parent 3ee29f30f3
commit 42fd6f783f
+5 -2
View File
@@ -38,6 +38,7 @@ tryPutItemInInv mcipos itid w = do
& cWorld . lWorld . items . ix itid . itLocation .~ itloc & cWorld . lWorld . items . ix itid . itLocation .~ itloc
& cWorld . lWorld . floorItems . at itid .~ Nothing & cWorld . lWorld . floorItems . at itid .~ Nothing
& updateselectionextra invid & updateselectionextra invid
& updateselection (invid ^. unNInt)
& updatecloseitemset & updatecloseitemset
& maybeselect invid & maybeselect invid
& cWorld . highlightItems . at itid ?~ 20 & cWorld . highlightItems . at itid ?~ 20
@@ -53,8 +54,10 @@ tryPutItemInInv mcipos itid w = do
updatecloseitemset = fromMaybe id $ do updatecloseitemset = fromMaybe id $ do
i <- mcipos i <- mcipos
return $ hud . diSections . ix 3 . ssSet %~ IS.deleteShift i return $ hud . diSections . ix 3 . ssSet %~ IS.deleteShift i
updateselectionextra i = (hud . diSections . ix 0 . ssSet %~ IS.map (f i)) updateselectionextra i = hud . diSections . ix 0 . ssSet %~ IS.map (f i)
. (hud . diSelection . _Just . slInt %~ f i) updateselection i = case w ^. hud . diSelection of
Just (Sel 0 j) | j >= i -> hud . diSelection . _Just . slInt +~ 1
_ -> id
f j i | i >= _unNInt j = i + 1 f j i | i >= _unNInt j = i + 1
| otherwise = i | otherwise = i