Remove inventory selection on item drop/pickup

This commit is contained in:
2024-11-04 19:45:12 +00:00
parent 3f9b31a838
commit 489ff21e12
6 changed files with 17 additions and 20 deletions
+8 -16
View File
@@ -243,32 +243,24 @@ updateSection sis mcsel availablelines ss =
si <- sis ^? ix csel
let xselsize = length $ _siPictures si
return $ case sum $ fmap (length . _siPictures) . fst . IM.split csel $ sis of
pos
| pos == 0 || length allstrings <= availablelines ->
0
pos
| pos - 1 < oldoffset ->
pos - 1
pos
| maxcsel == csel ->
pos - availablelines + xselsize
pos
| pos + 1 + xselsize - availablelines > oldoffset ->
pos | pos == 0 || length allstrings <= availablelines -> 0
pos | pos - 1 < oldoffset -> pos - 1
pos | maxcsel == csel -> pos - availablelines + xselsize
pos | pos + 1 + xselsize - availablelines > oldoffset ->
pos - availablelines + 1 + xselsize
_
| length allstrings - oldoffset < availablelines ->
_ | length allstrings - oldoffset < availablelines ->
length allstrings - availablelines
_ -> oldoffset
tweakfirst (x : xs)
| offset > 0 =
(color moreupcolor $ text (theindent ++ replicate 15 (toEnum 30))) :
color moreupcolor (text (theindent ++ replicate 15 (toEnum 30))) :
xs
| otherwise = (x : xs)
| otherwise = x : xs
tweakfirst [] = []
moreupcolor = fromMaybe white $ allstrings ^? ix offset . _1
shownitems
| length shownstrings > availablelines =
(map h $ take (availablelines - 1) shownstrings)
map h (take (availablelines - 1) shownstrings)
++ [color moredowncolor . text $ theindent ++ replicate 15 (toEnum 31)]
| otherwise = map h shownstrings
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1