Remove inventory selection on item drop/pickup
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
All good (594 modules, at 19:29:05)
|
||||
All good (594 modules, at 19:44:39)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -76,13 +76,15 @@ rmInvItem cid invid w =
|
||||
& pointcid . crInvHotkeys %~ IM.delete invid
|
||||
& pointcid . crInvHotkeys %~ IM.mapKeys g
|
||||
& updateselection
|
||||
& updateselectionextra
|
||||
& pointcid %~ updateRootItemID
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
where
|
||||
-- & updateCreatureItemLocations cid
|
||||
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
updateselectionextra | cid == 0 = hud . hudElement . diSelectionExtra .~ 0
|
||||
| otherwise = id
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
scrollAugInvSel (-1) . scrollAugInvSel 1 -- . updateInventorySectionItems
|
||||
|
||||
@@ -42,9 +42,12 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
-- second for the root/selected item bools
|
||||
& cWorld . lWorld %~ crUpdateItemLocations cid
|
||||
& setInvPosFromSS
|
||||
& updateselectionextra
|
||||
& cWorld . lWorld %~ crUpdateItemLocations cid
|
||||
)
|
||||
where
|
||||
updateselectionextra | cid == 0 = hud . hudElement . diSelectionExtra .~ 0
|
||||
| otherwise = id
|
||||
it = _flIt flit
|
||||
maybeInvSlot = checkInvSlotsYou it w
|
||||
-- not sure if the following is necessary
|
||||
|
||||
@@ -74,7 +74,7 @@ drawInventory sss w cfig =
|
||||
curs = invCursorParams w
|
||||
iextra = fromMaybe mempty $ do
|
||||
inv <- w ^? cWorld . lWorld . creatures . ix 0 . crInv
|
||||
guard =<< fmap (not . isFilteringInv) (w ^? hud . hudElement . diSections)
|
||||
guard . not . isFilteringInv =<< (w ^? hud . hudElement . diSections)
|
||||
return . inventoryExtra sss cfig w $ invAdj inv
|
||||
|
||||
drawRootCursor :: World
|
||||
|
||||
@@ -41,7 +41,7 @@ nextInSectionSS ::
|
||||
IM.IntMap (SelectionSection a) ->
|
||||
Maybe (Int, Int) ->
|
||||
Maybe (Int, Int)
|
||||
nextInSectionSS sss = ssScrollUsing ssLookupNextMax sss
|
||||
nextInSectionSS = ssScrollUsing ssLookupNextMax
|
||||
|
||||
--setFirstPosSelectionSections :: SelectionSections a -> SelectionSections a
|
||||
--setFirstPosSelectionSections sss = fromMaybe sss $ do
|
||||
|
||||
Reference in New Issue
Block a user