Tweak combine inventory regex
This commit is contained in:
+27
-41
@@ -60,7 +60,6 @@ defaultListDisplayParams =
|
||||
invDisplayParams :: World -> ListDisplayParams
|
||||
invDisplayParams w =
|
||||
defaultListDisplayParams
|
||||
-- & ldpWidth .~ FixedSelectionWidth topInvW
|
||||
& ldpCursorType .~ BorderCursor selcursortype
|
||||
& ldpWidth .~ FixedSelectionWidth (determineInvSelCursorWidth w)
|
||||
where
|
||||
@@ -106,13 +105,8 @@ drawSubInventory subinv cfig w = case subinv of
|
||||
NoSubInventory -> drawNoSubInventory cfig w
|
||||
ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w
|
||||
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
|
||||
CombineInventory sl ->
|
||||
let mi = _smSelPos sl
|
||||
in titledSub'
|
||||
cfig
|
||||
"COMBINE"
|
||||
sl
|
||||
<> combineInventoryExtra sl mi cfig w
|
||||
CombineInventory sl -> titledSub' cfig "COMBINE" sl
|
||||
<> combineInventoryExtra sl (_smSelPos sl) cfig w
|
||||
|
||||
titledSub :: Configuration -> String -> SelectionList a -> Picture
|
||||
titledSub cfig subtitle subitems =
|
||||
@@ -155,15 +149,13 @@ floorItemPickupInfo n itm
|
||||
| n >= ceiling (_itInvSize itm) = ", but you have space to pick it up."
|
||||
| otherwise = ", and you don't have space to pick it up."
|
||||
|
||||
-- this should not produce Nothing, and the logic should be changed to reflect
|
||||
-- this
|
||||
-- note the use of ^?!
|
||||
-- it is probably desirable for this to crash hard for now
|
||||
yourAugmentedItem :: (Item -> a) -> a -> (Either FloorItem Button -> a) -> World -> a
|
||||
yourAugmentedItem f x g w = case you w ^? crInvSel . isel of
|
||||
Just (SelItem i _) -> f $ yourInv w ^?! ix i
|
||||
Just (SelCloseObject i) -> g $ w ^?! hud . closeObjects . ix (i - n - 1)
|
||||
Just (SelCloseObject i) -> g $ w ^?! hud . closeObjects . ix i
|
||||
_ -> x
|
||||
where
|
||||
n = length $ yourInv w
|
||||
|
||||
drawNoSubInventory :: Configuration -> World -> Picture
|
||||
drawNoSubInventory cfig w =
|
||||
@@ -193,36 +185,30 @@ drawNoSubInventory cfig w =
|
||||
f col invid epos = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos
|
||||
|
||||
examineInventoryExtra :: Maybe Int -> Maybe Item -> Configuration -> Picture
|
||||
examineInventoryExtra mtweaki mitm cfig =
|
||||
pictures
|
||||
[ fromMaybe mempty $ do
|
||||
tweaki <- mtweaki
|
||||
-- consider moving this functionality out into a tweaks module
|
||||
tparam <- mitm ^? _Just . itTweaks . tweakParams . ix tweaki
|
||||
return $ listCursorNSW subInvX 60 cfig tweaki 0 white (length $ showTweak tparam) 15
|
||||
-- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
|
||||
]
|
||||
examineInventoryExtra mtweaki mitm cfig = fromMaybe mempty $ do
|
||||
tweaki <- mtweaki
|
||||
-- consider moving this functionality out into a tweaks module
|
||||
tparam <- mitm ^? _Just . itTweaks . tweakParams . ix tweaki
|
||||
return $ listCursorNSW subInvX 60 cfig tweaki 0 white (length $ showTweak tparam) 15
|
||||
-- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
|
||||
|
||||
combineInventoryExtra :: SelectionIntMap CombinableItem -> Maybe Int -> Configuration -> World -> Picture
|
||||
combineInventoryExtra sm mi cfig w =
|
||||
pictures
|
||||
[ fromMaybe mempty $ do
|
||||
i <- mi
|
||||
let cpos = getIthPos i (sm ^. smShownItems)
|
||||
col <- sm ^? smShownItems . ix i . siColor
|
||||
return $
|
||||
pictures
|
||||
[ fromMaybe mempty $ do
|
||||
strs <- sm ^? smShownItems . ix i . siPayload . ciInfo
|
||||
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
|
||||
, fromMaybe mempty $ do
|
||||
lnks <- sm ^? smShownItems . ix i . siPayload . ciInvIDs
|
||||
return $
|
||||
lnkMidPosInvSelsCol cfig w cpos col lnks
|
||||
<> foldMap (topCursorTypeWidth listCursorNESW (topInvW + 2) cfig w) lnks
|
||||
<> combineCounts cfig w lnks
|
||||
]
|
||||
]
|
||||
combineInventoryExtra sm mi cfig w = fromMaybe mempty $ do
|
||||
i <- mi
|
||||
let cpos = getIthPos i (sm ^. smShownItems)
|
||||
col <- sm ^? smShownItems . ix i . siColor
|
||||
return $
|
||||
pictures
|
||||
[ fromMaybe mempty $ do
|
||||
strs <- sm ^? smShownItems . ix i . siPayload . ciInfo
|
||||
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
|
||||
, fromMaybe mempty $ do
|
||||
lnks <- sm ^? smShownItems . ix i . siPayload . ciInvIDs
|
||||
return $
|
||||
lnkMidPosInvSelsCol cfig w cpos col lnks
|
||||
<> foldMap (topCursorTypeWidth listCursorNESW (topInvW + 2) cfig w) lnks
|
||||
<> combineCounts cfig w lnks
|
||||
]
|
||||
|
||||
secondColumnParams :: ListDisplayParams
|
||||
secondColumnParams =
|
||||
|
||||
Reference in New Issue
Block a user