diff --git a/src/Dodge/Inventory/Add.hs b/src/Dodge/Inventory/Add.hs index a2b1acf65..53e2166ce 100644 --- a/src/Dodge/Inventory/Add.hs +++ b/src/Dodge/Inventory/Add.hs @@ -38,6 +38,7 @@ tryPutItemInInv mcipos itid w = do & cWorld . lWorld . items . ix itid . itLocation .~ itloc & cWorld . lWorld . floorItems . at itid .~ Nothing & updateselectionextra invid + & updateselection (invid ^. unNInt) & updatecloseitemset & maybeselect invid & cWorld . highlightItems . at itid ?~ 20 @@ -53,8 +54,10 @@ tryPutItemInInv mcipos itid w = do updatecloseitemset = fromMaybe id $ do i <- mcipos return $ hud . diSections . ix 3 . ssSet %~ IS.deleteShift i - updateselectionextra i = (hud . diSections . ix 0 . ssSet %~ IS.map (f i)) - . (hud . diSelection . _Just . slInt %~ f i) + updateselectionextra i = hud . diSections . ix 0 . ssSet %~ IS.map (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 | otherwise = i