Stop displaying hotkeys and equip positions, fixes space leak

This commit is contained in:
2025-01-05 22:33:05 +00:00
parent 9769480d0b
commit 2837f0d0af
3 changed files with 17 additions and 21 deletions
+10 -16
View File
@@ -16,7 +16,6 @@ module Dodge.DisplayInventory (
import Control.Applicative import Control.Applicative
import Control.Lens import Control.Lens
import Control.Monad import Control.Monad
import Data.Bifunctor
import Data.IntMap.Merge.Strict import Data.IntMap.Merge.Strict
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
import Data.IntSet (IntSet) import Data.IntSet (IntSet)
@@ -66,7 +65,6 @@ updateCombineSections w cfig =
(IM.fromDistinctAscList . zip [0 ..] $ combineList w) (IM.fromDistinctAscList . zip [0 ..] $ combineList w)
"COMBINATIONS" "COMBINATIONS"
$ w ^? hud . hudElement . subInventory . ciFilter . _Just $ w ^? hud . hudElement . subInventory . ciFilter . _Just
--invitms = fold $ w ^? hud . hudElement . diSections . ix 0 . ssItems
invitms = fold $ w ^? cWorld . lWorld . creatures . ix 0 . crInv invitms = fold $ w ^? cWorld . lWorld . creatures . ix 0 . crInv
--regexCombs :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool --regexCombs :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool
@@ -135,7 +133,7 @@ updateDisplaySections w cfig =
[-1 .. 5] [-1 .. 5]
[ invhead [ invhead
, sinv , sinv
, youx , IM.singleton 0 $ SelectionItem [displayFreeSlots (crNumFreeSlots cr)] 1 15 True invDimColor 2 ()
, nearbyhead , nearbyhead
, sclose , sclose
, interfaceshead , interfaceshead
@@ -152,11 +150,7 @@ updateDisplaySections w cfig =
(sfclose, sclose) = (sfclose, sclose) =
filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $ filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $
w ^? hud . hudElement . diCloseFilter . _Just w ^? hud . hudElement . diCloseFilter . _Just
nearbyhead = nearbyhead = if null sfclose then makehead "NEARBY ITEMS" else sfclose
if null sfclose
then if null sclose then mempty else makehead "NEARBY ITEMS"
else sfclose
youx = youitems
interfaceshead = if null btitems then mempty else makehead "NEARBY INTERFACES" interfaceshead = if null btitems then mempty else makehead "NEARBY INTERFACES"
interfaces = btitems interfaces = btitems
btitems = btitems =
@@ -164,20 +158,20 @@ updateDisplaySections w cfig =
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons) mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
makehead str = IM.singleton 0 $ SelectionInfo [str] 1 15 False white 0 makehead str = IM.singleton 0 $ SelectionInfo [str] 1 15 False white 0
invhead = if null sfinv then makehead "INVENTORY" else sfinv invhead = if null sfinv then makehead "INVENTORY" else sfinv
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 15 True invDimColor 2 () cr = you w
thetext = displayFreeSlots (crNumFreeSlots cr)
closeitms = closeitms =
IM.fromDistinctAscList . zip [0 ..] $ IM.fromDistinctAscList . zip [0 ..] $
mapMaybe (closeItemToSelectionItem w) (w ^. hud . closeItems) mapMaybe (closeItemToSelectionItem w) (w ^. hud . closeItems)
invitems = invitems =
IM.map IM.map
(uncurry (invSelectionItem w)) (uncurry (invSelectionItem w))
(fmap (first removeindentiffiltering) . allInvLocs $ _crInv cr) (allInvLocs $ _crInv cr)
removeindentiffiltering =
if maybe False (not . null) (w ^? hud . hudElement . diInvFilter . _Just) -- (fmap (first removeindentiffiltering) . allInvLocs $ _crInv cr)
then const 0 -- removeindentiffiltering =
else id -- if maybe False (not . null) (w ^? hud . hudElement . diInvFilter . _Just)
cr = you w -- then const 0
-- else id
filterSectionsPair :: filterSectionsPair ::
Bool -> -- check for whether filter is in focus, changes string at the end Bool -> -- check for whether filter is in focus, changes string at the end
+1 -1
View File
@@ -5,7 +5,7 @@ import Dodge.Data.Equipment.Misc
eqPosText :: EquipSite -> String eqPosText :: EquipSite -> String
eqPosText ep = case ep of eqPosText ep = case ep of
OnHead -> "HEAD" OnHead -> "HEAD"
OnChest -> "CHESt" OnChest -> "CHEST"
OnBack -> "BACK" OnBack -> "BACK"
OnLeftWrist -> "L.WRIST" OnLeftWrist -> "L.WRIST"
OnRightWrist -> "R.WRIST" OnRightWrist -> "R.WRIST"
+6 -4
View File
@@ -24,7 +24,8 @@ import Picture.Base
invSelectionItem :: World -> Int -> LocationLDT ItemLink ComposedItem -> SelectionItem () invSelectionItem :: World -> Int -> LocationLDT ItemLink ComposedItem -> SelectionItem ()
invSelectionItem w indent loc = invSelectionItem w indent loc =
SelectionItem SelectionItem
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey) -- { _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
{ _siPictures = pics -- & ix 0 %~ (++ anyequippos ++ anyhotkey)
, _siHeight = itInvHeight $ ci ^. _1 , _siHeight = itInvHeight $ ci ^. _1
, _siWidth = 15 , _siWidth = 15
, _siIsSelectable = True , _siIsSelectable = True
@@ -38,7 +39,9 @@ invSelectionItem w indent loc =
cr = lw ^?! creatures . ix 0 cr = lw ^?! creatures . ix 0
itid = ci ^. _1 . itID . unNInt itid = ci ^. _1 . itID . unNInt
anyhotkey = maybe [] ((' ' :) . hotkeyToString) (lw ^? imHotkeys . unNIntMap . ix itid) anyhotkey = maybe [] ((' ' :) . hotkeyToString) (lw ^? imHotkeys . unNIntMap . ix itid)
anyequippos = maybe [] (rightPad 8 ' ' . (' ' :) . eqPosText) anyequippos = maybe
[]
(rightPad 8 ' ' . (' ' :) . eqPosText)
(ci ^? _1 . itLocation . ilEquipSite . _Just) (ci ^? _1 . itLocation . ilEquipSite . _Just)
col = itemInvColor ci col = itemInvColor ci
pics = itemDisplay w cr ci pics = itemDisplay w cr ci
@@ -93,7 +96,6 @@ closeButtonToSelectionItem w i = do
} }
closeItemToTextPictures :: FloorItem -> ([String], Color) closeItemToTextPictures :: FloorItem -> ([String], Color)
closeItemToTextPictures flit = closeItemToTextPictures flit = (basicItemDisplay it, itemInvColor $ baseCI it)
(basicItemDisplay it, itemInvColor $ baseCI it)
where where
it = _flIt flit it = _flIt flit