Cancel terminal display if destroyed while displaying
This commit is contained in:
+12
-17
@@ -1,10 +1,7 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module Dodge.Render.HUD (
|
||||
drawHUD,
|
||||
) where
|
||||
module Dodge.Render.HUD (drawHUD) where
|
||||
|
||||
import Dodge.Data.Terminal.Status
|
||||
import Control.Applicative
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -23,6 +20,7 @@ import Dodge.Data.Config
|
||||
import Dodge.Data.DoubleTree
|
||||
import Dodge.Data.EquipType
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.Terminal.Status
|
||||
import Dodge.Data.World
|
||||
import Dodge.DoubleTree
|
||||
import Dodge.Equipment.Text
|
||||
@@ -34,7 +32,6 @@ import Dodge.Item.InvSize
|
||||
import Dodge.Item.Location
|
||||
import Dodge.ListDisplayParams
|
||||
import Dodge.Render.Connectors
|
||||
--import Dodge.Render.HUD.Carte
|
||||
import Dodge.Render.List
|
||||
import Dodge.ScreenPos
|
||||
import Dodge.SelectionSections
|
||||
@@ -105,9 +102,7 @@ getRootItemBounds i inv = do
|
||||
drawMouseOver :: Configuration -> World -> Picture
|
||||
drawMouseOver cfig w =
|
||||
concat
|
||||
( invsel <|> combinvsel
|
||||
<|> drawDragSelecting cfig w
|
||||
)
|
||||
(invsel <|> combinvsel <|> drawDragSelecting cfig w)
|
||||
<> concat (drawDragSelected cfig w)
|
||||
where
|
||||
invsel = do
|
||||
@@ -211,14 +206,14 @@ drawExamineInventory cfig w =
|
||||
)
|
||||
where
|
||||
f str =
|
||||
SelectionItem
|
||||
SelItem
|
||||
{ _siPictures = [str]
|
||||
, _siWidth = 55
|
||||
, _siHeight = 1
|
||||
, _siIsSelectable = True
|
||||
, _siColor = white
|
||||
, _siOffX = 0
|
||||
, _siPayload = ()
|
||||
, _siPayload = Nothing
|
||||
}
|
||||
|
||||
closeObjectInfo :: Int -> Either FloorItem Button -> String
|
||||
@@ -240,11 +235,10 @@ yourAugmentedItem f x g w = case you w ^? crManipulation . manObject of
|
||||
j <- w ^? hud . closeItems . ix i . unNInt
|
||||
flit <- w ^? cWorld . lWorld . floorItems . unNIntMap . ix j
|
||||
return . g $ Left flit
|
||||
-- g . Left $ w ^?! hud . closeItems . ix i
|
||||
Just (SelCloseButton i) -> fromMaybe x $ do
|
||||
j <- w ^? hud . closeButtons . ix i
|
||||
flit <- w ^? cWorld . lWorld . buttons . ix j
|
||||
return . g $ Right flit
|
||||
but <- w ^? cWorld . lWorld . buttons . ix j
|
||||
return . g $ Right but
|
||||
_ -> x
|
||||
|
||||
drawRBOptions :: Configuration -> World -> Picture
|
||||
@@ -347,7 +341,7 @@ combineInventoryExtra sss msel cfig w = fold $ do
|
||||
(i, j) <- msel
|
||||
si <- sss ^? ix i . ssItems . ix j
|
||||
let col = _siColor si
|
||||
lnks <- si ^? siPayload . ciInvIDs
|
||||
lnks <- si ^? siPayload . _Just . ciInvIDs
|
||||
return (lnkMidPosInvSelsCol cfig w j col lnks) <> foldMap invcursor lnks
|
||||
where
|
||||
invcursor i = do
|
||||
@@ -372,7 +366,7 @@ drawTerminalDisplay tid cfig w = fold $ do
|
||||
(drawSelectionListBackground secondColumnParams cfig tsize)
|
||||
<> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
|
||||
where
|
||||
toselitm (str, col) = SelectionItem [str] 1 55 True col 0 ()
|
||||
toselitm (str, col) = SelItem [str] 1 55 True col 0 Nothing
|
||||
-- not sure if the width (55) is correct here
|
||||
f tm =
|
||||
map toselitm . displayTermInput tm
|
||||
@@ -386,7 +380,8 @@ drawTerminalDisplay tid cfig w = fold $ do
|
||||
TerminalTextInput s ->
|
||||
(++ [(getPromptTM ++ s ++ [cFilledRect], white)])
|
||||
TerminalPressTo s ->
|
||||
(++ [(getPromptTM ++ "PRESS TO "++s, white)])
|
||||
(++ [(getPromptTM ++ "PRESS TO " ++ s, white)])
|
||||
|
||||
-- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w
|
||||
|
||||
lnkMidPosInvSelsCol :: Configuration -> World -> Int -> Color -> [Int] -> Picture
|
||||
@@ -504,4 +499,4 @@ selNumPosCardinal card cfig ldp sss i j = do
|
||||
ygap = _ldpVerticalGap ldp
|
||||
|
||||
selSecSelCol :: Int -> Int -> IM.IntMap (SelectionSection a) -> Maybe Color
|
||||
selSecSelCol i j sss = sss ^? ix i . ssItems . ix j . siColor
|
||||
selSecSelCol i j = (^? ix i . ssItems . ix j . siColor)
|
||||
|
||||
Reference in New Issue
Block a user