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