Commit before rethinking selection sets

This commit is contained in:
2026-05-12 08:05:39 +01:00
parent b213525c21
commit e4bd971017
5 changed files with 106 additions and 105 deletions
-3
View File
@@ -183,9 +183,6 @@ dropItem cr invid w' =
. soundStart (CrSound (_crID cr)) (cr ^. crPos . _xy) whiteNoiseFadeOutS Nothing
$ w'
where
--doanyitemdropeffect = fromMaybe id $ do
-- rmf <- itm ^? itEffect . ieOnDrop
-- return $ doInvEffect rmf itm cr
doanyitemdropeffect = itEffectOnDrop itm cr
itm = fromMaybe (error "dropItem cannot find item") $ do
itid <- cr ^? crInv . ix (NInt invid)
+2
View File
@@ -10,6 +10,7 @@ import Dodge.Data.CardinalPoint
import Dodge.Data.ScreenPos
import Picture.Data
import Linear
import qualified Data.IntSet as IS
data LDParams = LDP -- List display parameters
{ _ldpPos :: ScreenPos
@@ -34,6 +35,7 @@ data SelSection a = SelSection
, _ssShownItems :: [Picture]
, _ssShownLength :: Int
, _ssIndent :: Int
, _ssSet :: IS.IntSet
}
type IMSS a = IntMap (SelSection a)
+1
View File
@@ -267,6 +267,7 @@ updateSection indent mcsel sis availablelines oldoffset =
, _ssShownItems = shownitems
, _ssShownLength = min aslength availablelines
, _ssIndent = indent
, _ssSet = mempty
}
where
shownitems = tweakfirst . tweaklast $ take availablelines shownstrings
+4 -1
View File
@@ -95,8 +95,11 @@ rmInvItem cid invid w =
where
pointcid = cWorld . lWorld . creatures . ix cid
updateselectionextra
| cid == 0 = hud . diSelection . _Just . slSet %~ const mempty
| cid == 0 = hud . diSelection . _Just . slSet %~ IS.foldl' h mempty
| otherwise = id
h x i | i > _unNInt invid = IS.insert (i-1) x
| i < _unNInt invid = IS.insert i x
| otherwise = x
updateselection
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
scrollAugInvSel (-1) . scrollAugInvSel 1